jazz icon indicating copy to clipboard operation
jazz copied to clipboard

Expose sync status for CoValues

Open joeinnes opened this issue 5 months ago • 2 comments

Currently, we have the waitForSync method to allow forcing a sync and resolving on success. However, there is no way to get the current sync status of a CoValue, or the last time it was successfully synced.

Ideally, we would have a reactive subscription to the sync state of the CoValue, which developers can use to build features in their apps (e.g. pending sync status indicators, information on last sync time, etc.)

References:

  • https://discord.com/channels/1139617727565271160/1139621689882321009/1392503913059717242
  • https://discord.com/channels/1139617727565271160/1139621689882321009/1391089821593632821

joeinnes avatar Jul 09 '25 19:07 joeinnes

Are you imagining this would be implemented as...

  1. A subscription to the sync status for a specific peer
  2. A subscription to an array of statuses, one per peer
  3. A subscription to the "fully-sync'dness" of a covalue

Or all/none of the above? :)

justinrosenthal avatar Aug 05 '25 21:08 justinrosenthal

@justinrosenthal

The idea is to have an high-level API that devs can use to check the sync state of a group of values.

e.g.

const isSynced = useIsCoSynced(Schema, id, {
  resolve: {
     nestedProp: true
  }
})
const isConnected = useJazzConnectionState();

if (isSynced) return "synced"
if (isConnected) return "syncing"

return "not-synced"

gdorsi avatar Sep 11 '25 16:09 gdorsi