Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Only add items to the local store #6

Open
swigle opened this issue Jun 17, 2015 · 2 comments
Open

Only add items to the local store #6

swigle opened this issue Jun 17, 2015 · 2 comments

Comments

@swigle
Copy link

swigle commented Jun 17, 2015

Hi Andrew,

I'm working on a project. For this project we want to minimise data transfer between app/server.
We're implementing your offlineSyncStore for this reason.

I would like to know if it's possible to alter your code in a way so that if the server only sends new data, these new rows get added to the local store, instead of replacing them.

Now, when trying to accomplish this with the "loadServer" method, the local store items get removed if they're not present in the server call.

As you can imagine, this causes a lot of data transfer that isn't really necessary.

In an older version of the app we sent along the id's of the rows that were already synced, so only new rows were sent by the server. These rows were added to the local store. Sadly this wasn't a sencha project so i can't copy this.

The user can't make any changes on the device, so sync'ing the other way isn't necessary.

Any tips are appreciated!

@andrewmduncan
Copy link
Contributor

I'm not sure that I completely understand what you're doing but perhaps you could override the loadServer method to take a copy of the current records in localstorage, load the sencha store, then put the records back?

@swigle
Copy link
Author

swigle commented Jul 8, 2015

Thanks for your reply!

My goal was to minimize the amount of data transferred between app and server.
That's why i was wondering if there was a way to append data sent from the server to the local store instead of replacing the data.
By injecting a "last id" or something the server could only send new items and these should then be appended to the localstore.

I know appending is against the normal behaviour for sencha so i think this question is more a feature request.

For now i've created my own extended store that syncs with two proxies. Mine is way simpler because the user can't change data and no data needs to be sent to the server.

So This point can be closed i think. Maybe you can keep this idea in mind as a feature request (appending data to local store instead of replacing) for anybody else wanting to minimise data transfers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants