Skip to content

[lexical] Bug Fix: Workarounds in $config protocol for loose inheritance#7659

Merged
etrepum merged 2 commits intofacebook:mainfrom
etrepum:config-hasOwn
Jun 30, 2025
Merged

[lexical] Bug Fix: Workarounds in $config protocol for loose inheritance#7659
etrepum merged 2 commits intofacebook:mainfrom
etrepum:config-hasOwn

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@etrepum etrepum commented Jun 30, 2025

Description

Workarounds for #7258 combined with loose inheritance (not compliant with ES6)

Test plan

Can't really test this in-repo very easily since lexical is built as ES6

@vercel
Copy link
Copy Markdown

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2025 4:14pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2025 4:14pm

@facebook-github-bot facebook-github-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 Jun 30, 2025
if (!hasOwn(klass, 'importDOM') && hasOwn(klass, 'exportDOM')) {
if (
!hasOwnStaticMethod(klass, 'importDOM') &&
hasOwnExportDOM(klass)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This warning wasn't even working before because it was checking the class rather than the prototype 🤦

}
if ($isDecoratorNode(proto)) {
if (!hasOwn(proto, 'decorate')) {
if (proto.decorate === DecoratorNode.prototype.decorate) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this one can be weak since it might make sense in some scenarios to subclass a DecoratorNode but not override its decorate method

Copy link
Copy Markdown
Member

@zurfyx zurfyx left a comment

Choose a reason for hiding this comment

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

Thank you Bob for the quick follow ups as usual!

@etrepum etrepum added this pull request to the merge queue Jun 30, 2025
Merged via the queue into facebook:main with commit 3608030 Jun 30, 2025
39 checks passed
// TextNode.length > 0 will only be true if the compiler output
// is not ES6 compliant, in which case we can not provide this
// warning
if (__DEV__ && TextNode.length === 0) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is so smart ❤️

@etrepum etrepum deleted the config-hasOwn branch September 29, 2025 15:34
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.

4 participants