You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling $deleteTableRow__EXPERIMENTAL() when all table rows are selected produces an editor state (processed by update listeners) that has an invalid selection. The selection points to nodes that have been removed from the editor, so if you call $getSelection()?.getNodes() you will get an error Point.getNode: node not found.
Note: in the recording below the rendered HTML table doesn't show the selection, but the tree view below the editor shows the table cells are getting selected.
CleanShot.2025-02-06.at.16.45.50.mp4
Lexical version: 0.23.1
Steps To Reproduce
Have an editor state with a table and at least one other sibling node before it (e.g. paragraph).
Have an update listener that calls $getSelection?.getNodes() on every update.
Select all rows of the table, then take an action that runs $deleteTableRow__EXPERIMENTAL().
Observe the error Point.getNode: node not found is thrown.
The error Point.getNode: node not found is thrown because the selection is pointing to nodes that have been removed from the document.
The expected behavior
The selection should be fixed up (pointing to valid nodes) before update listeners are called with new updates.
Impact of fix
The most severe impact of this bug exists when you also use CollaborationPlugin, as this error causes Lexical and the Yjs doc to get out of sync. The table deletion doesn't propagate to the Yjs doc, so until the page is refreshed there is risk that user edits are corrupting the document in this unexpected state, and upon refresh users will see the table re-appear unexpectedly.
As a workaround, the error can be caught and handled to avoid this problem.
The text was updated successfully, but these errors were encountered:
Calling
$deleteTableRow__EXPERIMENTAL()
when all table rows are selected produces an editor state (processed by update listeners) that has an invalid selection. The selection points to nodes that have been removed from the editor, so if you call$getSelection()?.getNodes()
you will get an errorPoint.getNode: node not found
.Note: in the recording below the rendered HTML table doesn't show the selection, but the tree view below the editor shows the table cells are getting selected.
CleanShot.2025-02-06.at.16.45.50.mp4
Lexical version: 0.23.1
Steps To Reproduce
table
and at least one other sibling node before it (e.g.paragraph
).$getSelection?.getNodes()
on every update.$deleteTableRow__EXPERIMENTAL()
.Point.getNode: node not found
is thrown.Link to code example: https://stackblitz.com/edit/facebook-lexical-akmwfitx?file=src%2FApp.tsx
The current behavior
The error
Point.getNode: node not found
is thrown because the selection is pointing to nodes that have been removed from the document.The expected behavior
The selection should be fixed up (pointing to valid nodes) before update listeners are called with new updates.
Impact of fix
The most severe impact of this bug exists when you also use
CollaborationPlugin
, as this error causes Lexical and the Yjs doc to get out of sync. The table deletion doesn't propagate to the Yjs doc, so until the page is refreshed there is risk that user edits are corrupting the document in this unexpected state, and upon refresh users will see the table re-appear unexpectedly.As a workaround, the error can be caught and handled to avoid this problem.
The text was updated successfully, but these errors were encountered: