hoodiehq / hoodie-store-client

:dog: Hoodie Client for data persistence & offline sync
Apache License 2.0
39 stars 16 forks source link

make sure that store.clear() aborts all pending requests #53

Open gr2m opened 8 years ago

gr2m commented 8 years ago
// sends bulk update request, or creates database if it does not exist yet
store.push()

// disconnects & cancels all requests from above and makes `hoodie.store.push()` reject its promise
store.clear()
gr2m commented 8 years ago

we now call .disconnect() in .reset(). disconnect checks if there is an active replication and cancels it, but I see a potential issue when for example .pull and .push are called at the same time, as they both set state.replication. So .disconnect() will only cancel the last replication, but not the other

gr2m commented 8 years ago

also .reset() calls PouchDB’s .destroy() method and I would expect that it’s cancelling all pending requests by itself