Repository navigation
fix(editor): let Undo revert every write of a multi-request gesture - #35
Open
helloforvets wants to merge 1 commit into
Open
helloforvets wants to merge 1 commit into
helloforvets wants to merge 1 commit into
Conversation
Deleting a node is one gesture of two requests (App.tsx, removeNode): the removal, then a set-frontmatter that prunes the imports nothing reads any more. The undo step was owed one write when the gesture was queued (addGesture), so the first reply settled it to `applied` and recordApplied dropped the second write's inverse. Undo then put the nodes back without their imports, and Astro failed the page with "<Component> is not defined". sendGesture now owes the step one more write right before each later request goes out. Owing lazily keeps a retried gesture honest: a request that never went out (a retry stops at the first) is never waited for. A record no step reads (a preview's, dropped) stays dropped. Reproduced on 0.1.37 by deleting a page's wrapper element and pressing Undo: the wrapper returned, its nine component imports did not. Tests: the fake-send outcome table pins the step holding every write of a two-request gesture and nothing extra owed on a retry; an end-to-end case through main's real handlers deletes a wrapper, lets the prune follow, reverts the step, and expects the file byte for byte. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What
Undo after deleting a node restores the markup but not the imports the delete pruned. Astro then fails the page with
<Component> is not defined.Why
A delete is one gesture of two requests (
removeNodeinApp.tsx): theremove-node, then aset-frontmatterthat drops the imports nothing reads any more. The undo step is owed one write when the gesture is queued (addGesture), so the first reply settles it toappliedandrecordApplieddiscards the second write's inverse.revertedStepsthen reverts only the removal.Reproduced on 0.1.37: select a wrapper element holding several components in the Navigator, press Backspace, press ⌘Z. The wrapper comes back; its imports do not. The log shows two writes for the delete and one for the undo.
Fix
sendGestureowes the step one more write right before each later request goes out (oweAnother). Owing lazily keeps a retried gesture honest: a request that never went out is never waited for. A record no step reads (a preview's, dropped) stays dropped.Tests
pageEdits.test.js, the fake-send outcome table: the step holds every write of a two-request gesture; nothing extra is owed when the first request is refused with a retry.Both fail without the fix (
the undo step holds every write of the gesture,the step waited for both writes) and pass with it.npm run check:changedand the full gate pass.Aside, unrelated to this change: on a UTC+10 machine the full gate fails one pre-existing case,
renderer/history/historyPanel"today is Today". Its fixednowof 15:00Z minus two hours crosses local midnight there, so the group reads "Yesterday". It passes underTZ=UTC, as CI runs.🤖 Generated with Claude Code