#9166·lexical

Bug: Undo returns the mark of the deleted comment

Author: levenstaCreated Sep 13, 2026Updated Sep 13, 2026

Lexical version: 0.50.0

Steps To Reproduce

  1. Add a comment to the text
  2. Delete the comment thread in the right-hand panel
  3. Press Ctrl + Z

The current behavior

A state is returned containing an invalid marker that references a comment that no longer exists

https://github.com/user-attachments/assets/b973dd18-2e76-4e83-a66c-bfe34c16c41d

The expected behavior

During Undo/Redo operations, it is necessary to either restore the deleted comment in the right-hand panel or validate the mark ID and remove it if it references a non-existent comment

Impact of fix

The current issue creates redundant mark nodes in the state that do not reference anything. Any users basing their implementation on the CommentPlugin from the playground inherit this bug