Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

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

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

Comments

@pushkin-
Copy link

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
Copy link
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 as completed Aug 12, 2015
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