Skip to content

[Breaking Change][lexical] Bug Fix: Use asynchronous parent editor delegation when needed#8308

Merged
etrepum merged 1 commit intofacebook:mainfrom
etrepum:parent-editor-delegation
Apr 7, 2026
Merged

[Breaking Change][lexical] Bug Fix: Use asynchronous parent editor delegation when needed#8308
etrepum merged 1 commit intofacebook:mainfrom
etrepum:parent-editor-delegation

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@etrepum etrepum commented Apr 7, 2026

Breaking Changes

Unhandled dispatched commands are now asynchronously bubbled to parent editors if the parent editor is currently in an update, where in the previous version these commands would not be propagated (and in the version before that, they were propagated synchronously in a broken way).

Description

Delegating commands to parent editors is rarely used, error-prone, and has confusing semantics. However, it is useful particularly with SELECTION_CHANGE_COMMAND and the legacy behavior should be preserved until commands are overhauled (probably to also fix the priority inversion, and add more metadata/schema to them).

A small step towards cleaning this up was added in #8202, but it caused a regression because in this particular scenario asynchronous delegation is needed, but we had no e2e or unit test coverage of any situation where it should happen. This PR works around it in a different way by explicitly re-triggering command listeners asynchronously in the first updating ancestor editor (this will also propagate to its parents in the same way).

Closes #8306

Test plan

New unit tests to cover both synchronous and asynchronous parent editor delegation

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Apr 7, 2026 5:30pm
lexical-playground Ready Ready Preview, Comment Apr 7, 2026 5:30pm

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 Apr 7, 2026
@etrepum etrepum changed the title [lexical] Bug Fix: Use asynchronous parent editor delegation when needed to work around [lexical] Bug Fix: Use asynchronous parent editor delegation when needed Apr 7, 2026
@etrepum etrepum changed the title [lexical] Bug Fix: Use asynchronous parent editor delegation when needed [Breaking Change][lexical] Bug Fix: Use asynchronous parent editor delegation when needed Apr 7, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Apr 7, 2026
@etrepum etrepum marked this pull request as ready for review April 7, 2026 17:39
@etrepum etrepum added this pull request to the merge queue Apr 7, 2026
Merged via the queue into facebook:main with commit f55deb9 Apr 7, 2026
66 of 67 checks passed
@etrepum etrepum deleted the parent-editor-delegation branch April 7, 2026 21:32
@etrepum etrepum mentioned this pull request Apr 9, 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.

Bug: Commands do not bubble from nested editors to parent editors

2 participants