facebook / facebook/lexical

Bug: Undo returns the mark of the deleted comment

Open
#9,166 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
57

Description

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

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue through the CommentPlugin playground flow: add a comment, delete its thread from the right-hand panel, then use Ctrl+Z. Inspect the Undo/Redo state for mark IDs that reference missing comments; done means the deleted comment is restored or the invalid mark is removed, with no redundant mark nodes remaining.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.