Skip to content

[lexical][lexical-list] Bug Fix: Apply static transform and $config $transform from all superclasses#7926

Merged
etrepum merged 4 commits intofacebook:mainfrom
etrepum:list-transform-subclass
Oct 17, 2025
Merged

[lexical][lexical-list] Bug Fix: Apply static transform and $config $transform from all superclasses#7926
etrepum merged 4 commits intofacebook:mainfrom
etrepum:list-transform-subclass

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@etrepum etrepum commented Oct 16, 2025

Breaking Change

Before $config there was a limited amount of "automatic" re-use of the static transform by subclasses, because class inheritance also inherits static methods, so you get the implementation of whatever static transform method was in the superclass if it wasn't overridden.

Now the application of these static transforms (whether by method or $config) is implicit. There is no need to call super if adding an additional transform. The implementation walks up the inheritance tree by $config extends or Object.getPrototypeOf and will register all transforms it finds.

Description

When ListNode was subclassed, since it was refactored for $config, it no longer automatically applied its necessary static transform to subclasses. This resolves that issue.

See #7925

This does make it very difficult to subclass something without using its static transform as-is, but I think those sorts of use cases are better facilitated by moving the transforms to extensions and having the extension provide control over that (only in the cases where it makes sense). We could probably deprecate static transform and $config transform altogether when/if people are all-in on extensions.

Test plan

Unit tests added

@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 Oct 16, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Oct 16, 2025

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

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Oct 16, 2025 11:23pm
lexical-playground Ready Ready Preview Comment Oct 16, 2025 11:23pm

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Oct 17, 2025
@etrepum etrepum changed the title [lexical][lexical-list] Bug Fix: Apply static transform and $config $transform to all subclasses [lexical][lexical-list] Bug Fix: Apply static transform and $config $transform from all parent classes Oct 17, 2025
@etrepum etrepum changed the title [lexical][lexical-list] Bug Fix: Apply static transform and $config $transform from all parent classes [lexical][lexical-list] Bug Fix: Apply static transform and $config $transform from all superclasses Oct 17, 2025
@etrepum etrepum added this pull request to the merge queue Oct 17, 2025
Merged via the queue into facebook:main with commit 51fef51 Oct 17, 2025
69 of 70 checks passed
This was referenced Oct 27, 2025
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