You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:onSync(true)
will fire even if the first sync was unsuccesful, leading the app to incorrectly add the default dataThe 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.The text was updated successfully, but these errors were encountered: