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

PATCH support

Open nilbus opened this issue 10 years ago • 0 comments

Local attributes for models that are not yet synced can be lost after save(attrs, {patch: true})

A model will have a temporary id when it is recently created and has not yet been successfully synced.

When an un-synced model is updated with patch: true and the server responds with a partial or empty set of attributes, attributes not in the server response will be missing in the local copy. This happens because the unsynced version is discarded, and a new model is created locally. See backbone.dualstorage.coffee:271.

It instead should update the existing local model's attributes with the server response, just as it does for a synced model. #51 may change the way attributes are updated, so it may be best to wait to fix this until that is resolved.

nilbus avatar Sep 26 '13 19:09 nilbus