Advise around a sync engine with thousands of docs

@TeemuKoivisto Teemu Koivisto
Mon, 05 Jan 2026 12:00:17 +0000

Maybe try onUnsyncedChanges hook? Seems to correctly log the count of unsynced changes. You could just write it directly to IndexedDB as the unsynced boolean with data.number !== 0. Probably easier to write the offline changes back to the server in one batch REST request, so you can just await for the response and clear the cache.

Crucial though is to have 1 writer to coordinate the writing to IndexedDB—you don’t want the REST request to overwrite the Hocuspocus hook. If the doc is open the REST result doesn’t count, better to overwrite to DB than to skip unsynced changes. OR you can derive the last update version perhaps to compare which is the latest, but I don’t think it’s worth the trouble.