Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate active issues remain around queued command rejection leaving the pending insertion state uncleared across graph switches, so the new graph can continue intercepting editor input incorrectly.
2 open issues
What changed in this PR
This PR serializes asynchronous block insertion, undo, and redo commands per graph so history operations cannot overtake pending insertion work, while preserving text buffering and shortcut behavior during insertion.
Changes:
- Added a per-graph asynchronous command queue shared by insertion and history operations.
- Replaced debounced undo/redo handling with queued commands that preserve repeated input order.
- Added regression tests for command ordering, buffered text, and Ctrl/Cmd shortcut handling.
- Review findings: graph switches can leave pending insertion state uncleared when queued insertion is rejected, and A→B→A switches can allow stale queued commands to run in the restored session.
| File | Description |
|---|---|
| src/test/frontend/handler/history_test.cljs | Adds regression tests covering insertion, undo, and redo ordering while insertion preparation is delayed. |
| src/test/frontend/handler/editor_test.cljs | Adds tests for buffering ordinary text and excluding Ctrl/Cmd shortcut letters during pending insertion. |
| src/main/frontend/handler/history.cljs | Routes undo and redo operations through the shared asynchronous command queue. |
| src/main/frontend/handler/editor.cljs | Queues Enter-triggered block insertion and filters shortcut input while insertion is pending. |
| src/main/frontend/handler/common/editor.cljs | Implements the per-graph asynchronous command queue and graph-state validation. |
Review effort: Lite
megayu
force-pushed
the
fix/serialize-editor-history
branch
from
November 17, 2026 04:11
257eb0b to
0a1b67b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Pressing Enter starts an asynchronous block insertion. If Undo arrives while the editor is still preparing that insertion, the worker can receive Undo first and undo an earlier edit.
Queue insertion, undo, and redo in input order for each graph. Each command waits for the preceding command to settle, including its asynchronous preparation. This also preserves repeated history commands that the previous debounce could coalesce.
While an insertion is pending, keep buffering ordinary text and exclude Ctrl/Cmd shortcut letters so they do not change the block being edited.
Validation