oficina / docs Public

Docs: a resync keeps a paste that was waiting for its font

Claude Fable's P1 on #87. When a save was refused, attemptResync
destroyed the editor view while a paste was waiting for its font; the
wait then found its view gone, the paste was never made, and the strip
said the font was unavailable. Even made, its update would have been
dropped: ydoc.on('update') ignored everything while diverged.

Now, as Slides has it:
- attemptResync waits for a pending font action before it fetches the
  log and again just before it replaces the view, so the action runs
  on the view it was made in;
- updates written while diverged are kept, carried onto the rebuilt
  document before its view is mounted (so they are never off the sheet
  for a frame, and are one undo step: yUndoPlugin gets an UndoManager
  that tracks them), and saved through the new queue;
- only carried updates that integrate are posted: one written on top
  of the refused text cannot, and would sit pending in the log forever;
- from divergence the document writes under a fresh Yjs client id, so
  what is written after the refusal does not wait on refused clocks;
- the unload beacon sends what was written while diverged too.

And Fable's P2: the save queue says 'saving', not 'ok', when an answered
save leaves another queued. Docs shows no word for saving, so the
indicator rests as before.

resync_browser_test.go: Fable's probe (the paste lands straight after
the refused character, so it cannot be carried: not shown, not posted,
the save line says failed), the same with the refused edit elsewhere
(the paste is kept, once, on the sheet and the server, and never leaves
the sheet), and the accepted-save control. Both refused cases and the
new save-queue test fail on 88b60fa.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev d8dba0f2658d31923fee6588b44f60857ec16fda parent 88b60fa
6 files changed, +300 −29
  • fixtures/editor-entry.js +123 −13
  • fixtures/save-queue.mjs +11 −2
  • fixtures/save-queue.test.mjs +16 −0
  • internal/docs/resync_browser_test.go +136 −0
  • internal/docs/static/editor.455b88221c9de6ec.js +14 −0
  • internal/docs/static/editor.cd50554350b8c6aa.js +0 −14

CI passed — run details

fixtures/editor-entry.js

Loading diff…

fixtures/save-queue.mjs

Loading diff…

fixtures/save-queue.test.mjs

Loading diff…

internal/docs/resync_browser_test.go

Loading diff…

internal/docs/static/editor.455b88221c9de6ec.js

Loading diff…

internal/docs/static/editor.cd50554350b8c6aa.js

Loading diff…