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

RFE: A way to know if/when at least one sync has happened #1045

Open
aboodman opened this issue Mar 13, 2023 · 0 comments
Open

RFE: A way to know if/when at least one sync has happened #1045

aboodman opened this issue Mar 13, 2023 · 0 comments

Comments

@aboodman
Copy link
Contributor

People often want to know when the fist sync round trip has happened. One common reason for this is to initialize state with some default data. Waiting for onSync(true) sort of works except:

  • if the client already has local state, this is needlessly slow
  • it doesn't work at all in the offline case - onSync(true) will fire even if the first sync was unsuccesful, leading the app to incorrectly add the default data

The simplest way I can think of to accomplish this is to add a promise like firstServerResponse: Promise<void>. If the client knows it has already had one server response, it can resolve this immediately, otherwise it can wait.

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

No branches or pull requests

1 participant