Replies: 2 comments 8 replies
-
I like the Having better insight into what the sync client is doing right now also sounds helpful to me. We've seen a number of reports asking about why download progress seemingly stops at
|
Beta Was this translation helpful? Give feedback.
-
I also like the concept and functionality that a This might be more of an implementation question, so maybe not very relevant for now - but I was wondering how the I imagine the order would be something like:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Add a
db.checkpoint()
API for explicit sync feedback.Status
2025-08-14: Split out sync status changes into a separate proposal, as well as the more general Improve client-side sync diagnostics proposal
2025-08-13: Initial idea proposed. Need to evaluate whether the proposed APIs would solve the problems, and how it would interact with future diagnostics reporting to the service.
Background
For background on the problem statement, see Improve client-side sync diagnostics.
The changes here depend on Write checkpoint / checkpoint request protocol changes.
Proposal
Add a call that creates a new checkpoint request, waits for the requested checkpoint sync, throwing an error if it fails.
This would:
connect()
).The call does not automatically create a new connection, or actually change in of the sync behavior, with the exception of:
The Promise rejects if:
This means the call would wait for pending uploads, pending downloads, and pending write checkpoints. The timeout should be used sparingly - a long wait is expected when the client is downloading millions of operations. Note that #325 already adds a timeout on
waiting_for_requested_checkpoint
, meaning that no additional "inactivity timeout" is needed.The rejected error should include the specific reason for failure.
TODO
checkpoint()
?Use case / implementation examples
Push notifications
This is a common use case: The user received a push notification, opens the notification, and now expects the relevant data to be available. This API would explicitly wait until the data has been synced, or fail with an explicit reason if the data cannot be synced.
Pull-to-refresh
With a sync engine, users can generally expect data to be up-to-date all the time, and in most cases no explicit sync action is required. Selective usage of
useStatus()
can be used to indicate to users when that is not the case, for example indicating that the user is offline.However, adding a "pull-to-refresh" action that calls
checkpoint()
could help the user gain additional confidence - it can be used to give the user an explicit indication that "your data is up-to-date".Sync on startup
The
checkpoint()
API could be used as an explicit method to report sync status when the application is started, or at other points in the workflow. This could be used as a "request-style" alternative to waiting for a specific sync status.For this use case, care should be taken to not block the user from continuing if the user could work with data previously synced.
Waiting for server-side processing
At a certain part of an application workflow, the client may need to wait for a service response to be synced back. For example, let's say the user requested a PDF report to be generated, and is now waiting for the response to be synced, containing the results (including URL of the PDF).
Here, there are two scenarios:
While waiting, the client can periodically call
checkpoint()
, to make sure that the client is up-to-date. If thecheckpoint()
call resolves, and the response is still not synced, the client knows the server is still generating the report, rather than the response not being synced.Issue reporting
checkpoint()
errors could be good candidates to report to an error reporting service, for example:Beta Was this translation helpful? Give feedback.
All reactions