Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 'clear' flag in ISyncProtocol #443

Open
dfahlander opened this issue Jan 10, 2017 · 1 comment
Open

Implement 'clear' flag in ISyncProtocol #443

dfahlander opened this issue Jan 10, 2017 · 1 comment
Labels

Comments

@dfahlander
Copy link
Collaborator

The applyRemoteChanges() has a not-implemented 'clear' flag that should be implemented for the cases when a client has been offline for a very long time so that the server no more has the old revision saved, that the client refers to.

See nponiros/sync_server#5

@cbrachem
Copy link

I don't know much about the inner workings of Dexie or IndexedDB yet, but let me state the idea of replacing the return value of applyRemoteChanges(), shown here:

return (partial ? saveToUncommittedChanges(remoteChanges, remoteRevision) : finallyCommitAllChanges(remoteChanges, remoteRevision))
    .catch(function (error) {
      abortTheProvider(error);
      return Promise.reject(error);
    });

with something like this:

return (clear ? Promise.all(db.tables.map(table => table.clear())) : Promise.resolve())
    .then(() => partial ? saveToUncommittedChanges(remoteChanges, remoteRevision) : finallyCommitAllChanges(remoteChanges, remoteRevision))
    .catch(function (error) {
      abortTheProvider(error);
      return Promise.reject(error);
    });

What would be wrong with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants