[lexical][lexical-list] Bug Fix: Apply static transform and $config $transform from all superclasses#7926
Merged
etrepum merged 4 commits intofacebook:mainfrom Oct 17, 2025
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zurfyx
approved these changes
Oct 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking Change
Before
$configthere 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