Skip to main content
Lightning Jar - Web Studio Lightning Jar Wordmark

Findings No. 24

Undo that lands inside a serialize-debounce window can look dead

Cmd/Ctrl+Z within 250 ms of a keystroke hit a sync-guard flag that suppressed the re-seed: history and state moved, the DOM never reverted. The fast-fingers path deserves its own test.

Woof Editor Web Platform verified Svelte 5 runes; Chromium play-function test

Undo pressed immediately after typing is the single most common undo, and it is exactly the case a serialize debounce can break. In Woof Editor, Cmd/Ctrl+Z within the 250 ms debounce window after a keystroke forced a synchronous flush whose isSyncingFromWysiwyg flag was still set when effects ran, so the seed effect skipped the undo's re-seed. The history pointer moved, the markdown state moved, and the DOM never reverted: undo looked completely dead in the "typo, instant Cmd+Z" case, while working fine in slower tests.

The fix clears the flag synchronously before replaying history and gates the replay on canUndo/canRedo so a no-op undo cannot re-seed and clobber the caret. A Chromium play-function test pins the exact typo-then-instant-undo sequence.

The general rule: any guard flag that suppresses state-to-DOM syncing must be accounted for on every path that needs the sync, and the fast-fingers path deserves its own test.

Receipt: woof-editor CHANGELOG 0.2.0 (Fixed); the Chromium play-function regression test.

Ask Eljay

Ask about the studio's work, research, packages, or writing. A few starters:

Answers come from this site's own content and link their sources. For anything that matters, email hello@lightningjar.com.