Skip to content

fix(editor): smooth writing during autosave and pan/zoom (1.3.5) - #36

Merged
markm39 merged 2 commits into
mainfrom
fix/writing-save-stalls
Oct 13, 2026
Merged

markm39 merged 2 commits into
mainfrom
fix/writing-save-stalls

Conversation

@markm39

@markm39 markm39 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Fixes the 1.3.4 regression: strokes lagged ~1 s while writing (during autosave), and pan/zoom was very laggy.

Changes

  • Engine 0.3.9 (fix(ink): responsive pen input during saves; no per-frame re-render on pan/zoom (0.3.9) mobile-ink#60): stroke snapshot + native captureDocument off the main thread; sticky overscanned render target so pan/zoom doesn't re-render ink each frame. Pin lands once 0.3.9 is published.
  • Editor no longer re-renders ~60×/s during pan/zoom. useViewportTransformStore subscribed the whole note screen with useSyncExternalStore; it now only creates the store (consumers already subscribe directly).
  • Autosave never overlaps saves (autosaveQueue): a debounced save that fires while another is in flight waits for it, so an older capture can't land after newer ink. A save superseded by new ink reports pending (typed engine error), real failures still report error.
  • Version 1.3.5 (18).

Evidence (iPad Pro 13" M5 simulator, Release, 100-page dense fixture — not physical iPad)

1.3.4 this PR
Main-thread stall per autosave, median / max 59 / 63 ms 6 / 9 ms
Scroll + zoom test app CPU 3.47 s 1.68 s
Background save CPU (35 s writing) 7.46 s 2.36 s

New testDenseWritingDuringAutosavePerformance writes strokes 400 ms apart so every stroke overlaps a save.

Tests

  • npm test 116 pass (new autosaveQueue.test.mjs: no overlapping saves, superseded vs real failure), tsc clean.
  • All 11 OpenNotesUITests pass on the Release simulator build: cross-page stroke undo/redo/save/relaunch/PDF export, text/asset history, image crop, dense audit, invalid payload recovery, performance cases.

@markm39
markm39 marked this pull request as ready for review October 13, 2026 16:02
@markm39
markm39 merged commit 3431ccb into main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant