Repository navigation
fix(muya): ignore a quick-insert pick once its paragraph is gone (#5213) - #5289
Merged
Merged
Conversation
The quick-insert menu remembers the paragraph where `/` was typed. If that paragraph left the document while the menu was still open, picking an item passed it to `replaceBlockByLabel`. `replaceWith` bails for a block without a parent, so the new block was never inserted, and moving the caret into it threw "Cannot destructure property 'path' of 'this.parent' as it is null". Only replace the block while it is still attached; the menu hides either way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015EPgRzXj7DDhJToWxHtkkR
…ed (#5213) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015EPgRzXj7DDhJToWxHtkkR
This was referenced Sep 15, 2026
Closed
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
Fixes #5213
Crash report (v0.20.0-rc.1):
TypeError: Cannot destructure property 'path' of 'this.parent' as it is null.The stack runs from a click on a quick-insert item:ParagraphQuickInsertMenu.selectItem→replaceBlockByLabel→finishInsertedBlock→placeCaretInNewBlock→ParagraphContent.setCursor.Cause: the menu stores the paragraph where
/was typed and never re-checks it inselectItem. If that paragraph has left the document while the menu is still open:replaceBlockByLabelcallsblock.replaceWith(newBlock), which only logs a warning for a block without a parent, so the new block is never inserted.Fix:
selectItemonly replaces the block while it is still attached (outMostBlock), the same guard the code-block language selector got in #4677. The menu hides either way.About the test: I could not find the user action that removes the paragraph while the menu stays open (undo with the menu open leaves it in place). The e2e test removes the paragraph directly, like the #4654 language-selector test.
Test plan
e2e/tests/ui/quick-insert-detached-5213.spec.ts): open the menu with/, remove the paragraph, click "Bullet List". Expected: nopageerror, and the menu hides. Before the fix: the TypeError above.e2e/tests/ui/slash-menu.spec.tsstill passespnpm -C packages/muya test,pnpm -C packages/muya lint:types, eslint on the changed file🤖 Generated with Claude Code
https://claude.ai/code/session_015EPgRzXj7DDhJToWxHtkkR