Skip to content

[lexical-devtools-core] Bug Fix: Clean up strict mode useLexicalCommandsLog behavior#8230

Merged
etrepum merged 1 commit intofacebook:mainfrom
etrepum:useLexicalCommandsLog-cleanup
Mar 17, 2026
Merged

[lexical-devtools-core] Bug Fix: Clean up strict mode useLexicalCommandsLog behavior#8230
etrepum merged 1 commit intofacebook:mainfrom
etrepum:useLexicalCommandsLog-cleanup

Conversation

@etrepum
Copy link
Collaborator

@etrepum etrepum commented Mar 17, 2026

Description

The useLexicalCommandLog indexes would skip entries when run in dev (React strict mode) because setState callbacks are called twice. The callback had observable side-effects.

Test plan

Before

Run pnpm dev and observe the command log indices missing numbers in the series (e.g. 1, 3, 5, 7)

After

Run pnpm dev and observe that the command log indices are now dense (e.g. 1, 2, 3, 4)

@vercel
Copy link

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Mar 17, 2026 7:45pm
lexical-playground Ready Ready Preview, Comment Mar 17, 2026 7:45pm

Request Review

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 17, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Mar 17, 2026
payload,
type: command.type ? command.type : 'UNKNOWN',
};
setLoggedCommands((state) => [...state.slice(-9), entry]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual fix, the rest of the PR is just cleanup

@etrepum etrepum added this pull request to the merge queue Mar 17, 2026
Merged via the queue into facebook:main with commit 2d5cedf Mar 17, 2026
44 of 70 checks passed
@etrepum etrepum mentioned this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants