-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: Weird list item state causes infinite loop on insertParagraph #7036
Copy link
Copy link
Closed
Description
Lexical version: 0.18.0 and above
Steps To Reproduce
- Create any list with an initial non-empty list item
- Press Enter and then Tab to create a nested list item, add text to it
- Press Enter again and in the empty nested list item, toggle off the current list (i.e. set block type to paragraph)
- Start typing, which will cause the text to be inserted in the last non-nested list item next to the nested list
- Press Enter again (basically trigger
selection.insertParagraph()from that text node)
Link to code example: https://playground.lexical.dev
The current behavior
Pressing Enter in that text node causes an infinite loop.
lexical-list-item-issue.mp4
On Firefox the page freezes indefinitely. On Chrome, it throws this error after a while of freezing:
The expected behavior
It should correctly split the item (or create a new item if pressed Enter at the end)
Impact of fix
This makes it effectively impossible to add something new to the document if the list item is at the end of the document. Even if it is not at the end of the document, this makes the document uneditable until you refresh the page.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
