{{ message }}
Repository navigation
fix(muya): ignore a table tool click once its table left the document (#5442) - #5443
Merged
Merged
Conversation
…#5442) The table row menu and the table column toolbar keep the cell they were opened on. An Edit > Undo that removed the table left both floats on screen pointing at a detached cell, and every item then threw "Cannot destructure property 'path' of 'this.parent' as it is null" — the "Unexpected error" dialog in the desktop app, with the edit lost. Act only while that cell is still in the document, and hide the float otherwise. The column toolbar's `!block.parent` guard did not catch this: `TreeNode#remove` clears only the removed table's own parent, so a cell inside it keeps its row and the guard passed. Fixes #5442 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…5442) Co-Authored-By: Claude Opus 5 (1M context) <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.

Fixes #5442.
The table row menu and the table column toolbar remember the cell they were opened on. An Edit > Undo that removed the table left both floats on screen pointing at a detached cell, and clicking any of their items threw:
In the desktop app that raises the "Unexpected error" dialog, and the edit is lost. Same shape as #5213 (quick-insert menu) and #5355 (table size grid).
Both
selectItemhandlers now act only while the cell is still in the document, and hide the float otherwise. The column toolbar already had a!block.parentguard, but it does not catch this case:TreeNode#removeclears only the removed table's ownparent, so a cell inside it keeps its row —outMostBlockis the check that returnsnullonce the subtree left the document.Testing
packages/muya/e2e/tests/ui/table-tools-detached-5442.spec.ts— insert a table through the/grid, open each float, Undo the table away, then click every item: three row-menu items and six column-toolbar items. Each spec fails ondevelop(3 and 6 renderer errors) and passes here, with the document left unchanged. A third spec keeps the row menu editing a table that is still in the document.pnpm -C packages/muya test(1823 passed),lint,lint:types, and the Chromium e2e suite all pass; the threeinline/format-toolbar+inline/shortcutstriple-click failures on this machine reproduce on unmodifieddevelopand are the known engine-dependent selection specs called out inplaywright.config.ts.🤖 Generated with Claude Code