-
Notifications
You must be signed in to change notification settings - Fork 108
syncDirtyAndDestroyed() doesn't remove/clear ###_dirty in localStorage #129
Comments
Check out |
If I run |
Backbone.Collection.prototype.syncDirty = (options) ->
store = localStorage.getItem("#{getStoreName(@)}_dirty")
ids = (store and store.split(',')) or []
for id in ids
@get(id)?.save(null, options) For each id marked dirty, it tries to get the model from the collection by that id. If a model with that id exists, it will try to save it. Save should call sync, which is overridden to be dualsync. dualsync = (method, model, options) ->
# ...
# execute only online sync
return onlineSync(method, model, options) if _.result(model, 'remote') or _.result(model.collection, 'remote')
# execute dual sync
# ... If neither the model nor collection have a truthy As dualsync executes, |
Got it. The response on the PUT call is empty, but status is 200. Backbone handles this as an error but since the error is never logged I didn't know the call was not successful. I fixed this by adding
|
Hi,
After a syncDirtyAndDestroyed() on a collection the "###_dirty" still contains an id of a model. I get a status-code 200 from the server. Since dualStorage is not fetching models that are in the dirty list our app get stuck on models that are marked dirty.
I cannot find in the code where the ###_dirty is cleared
The text was updated successfully, but these errors were encountered: