Dirty/Destroyed models not be cleared from localStorage after an online sync. #147

Closed
pushkin- opened this Issue Aug 5, 2015 · 1 comment

Projects

None yet

2 participants

@pushkin-
pushkin- commented Aug 5, 2015

Related to #146
Let's say I have a model in localStorage. Its key would be something like http://ip/some/path/stuff_dirty.

When I come back online and call syncDirtyAndDestroyed, I expect all the _dirty (and _destroyed) models to be cleared from localStorage. However, this does not happen.

Perhaps this changes something, but I'm testing this from the console. I'm calling mystore.save(somemodel) and then disconnecting and reconnecting twice. Both times it tries to sync that model (2 POSTS).

I feel like there should be a window.localStorage.clear() after the syncDirtyAndDestroyed (at the end of). Of course it would have to be implemented more carefully, because if the sync fails, localstorage would still be cleared. It would need to remove only the models that were successfully synced.

Edit:
Actually, I see now that syncDirty calls save which in turn calls dualsync. Something in there should be clearing localStorage.

@nilbus
Owner
nilbus commented Aug 12, 2015

I think this must be the same issue as #146. I'll close this in favor of that one.

@nilbus nilbus closed this Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment