Sync / Editing server data

Failure modes and recovery

  • Offline edits: Pending edits stay in the outbox across reloads and flush on reconnect.
  • Table write lag or failure: Committed edits keep showing on screen while revision lags; the next exchange retries settle, and absorb waits until recovery succeeds.
  • Duplicate write after a crash: applyEdits checks revision <= at, making repeated application harmless.
  • Refused edit or forged stamp: validate and authorize reject bad operations or client-supplied stamps before commit; the sender drops the rejected edit and marks its cells.
  • Missing row: Validate row existence before committing in the journal so edits to missing rows fail visibly rather than vanishing after recovery.
  • Server reset: When a journal starts a fresh epoch, onReinstall fires with reset, clears held overlays, and refreshes cached rows. Reset the SQL table alongside the journal: settle refuses to run (TableAheadOfJournalError) whenever tableRevision exceeds the journal's cursor.
  • Sorted lists: An unabsorbed edit updates the cell value in place until the next query re-sorts rows on the server.
  • Recovery cursor: In persistent deployments, recovery replays from the journal floor after a restart, while the effect ledger prevents duplicate side effects within an epoch.

Limits and when to use simpler tools

  • Cell values are last-writer-wins by commit order; use CRDT-backed documents for collaborative rich text.
  • The journal and the SQL table must be kept or reset together.
  • If the dataset fits comfortably in memory on every client, use a plain Sync slice.
  • If edits only happen online, use a Remote mutation.

Next