Sporran re-creates local database on refresh
opened this issue · comments
Every time the page is refreshed and initializes Sporran, it re-creates the local db, thus deleting all the contents of the existing one.
Yes, this is at the moment by design, a couple of points here,
Leaving the local db intact is OK, we can add a destroy local db method for users to use when they want. We could make this the default behaviour, this way we avoid needing a flag, if the user wishes a clean local db he just calls the destroy method.
If do use a flag we would need it on construction, the constructor already has enough parameters, a better method now would be an initialisation class which the user could set up and pass, if null is used
then we use a default class.
Staleness may become a problem, if local data is persisted long enough the CouchDb id's/revs may change. This shouldn't happen if you are the only user of your CouchDB database, but you might not be, we don't enforce this.
Can we have a high level flow on how the sync works?
What are the records considered for syncing?
Does the records in couchdb get downloaded to local storage?
Sporran updated to preserve the local DB if requested. I'll open a separate issue for the documentation updates.