Backbone.dualStorage icon indicating copy to clipboard operation
Backbone.dualStorage copied to clipboard

Correct handling of fetch's merge and add options

Open nilbus opened this issue 10 years ago • 2 comments

Right now, localsync create does some things differently depending on the add and merge options. Should it be? Localsync should probably emulate/mirror the server response, and not care what options are passed to fetch and subsequently set.

Often when using add: true or merge: true with fetch, you're dealing with an API endpoint that does not return a full result set.

nilbus avatar Oct 21 '13 17:10 nilbus

I have sync scenarios like this: A) client contact the server via API, looking for updates since last call; B) user works on client, locally, later saves data via API on server; C) in next call to API from any client ONLY new data since last call will be downloaded.

From any client:

  1. By first call client get all records from server (~7000 recs)
  2. By second call client get all records modified, added, deleted since 1 (# recs << 7000)

The problem With dualStorage the localStorage saves only records in call 2 - clearing all data from call 1, is there a way to merge partial set in the second call with the - already saved locally - first big set?

PS: I think this is related to #90

Thanks for your work and time!

luke83 avatar Feb 06 '16 16:02 luke83

I don't think this library has a good solution for this right now, but I'm open to ideas.

nilbus avatar Feb 07 '16 03:02 nilbus