Skip to content

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

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

etrepum merged 2 commits into
facebook:mainfrom
etrepum:config-hasOwn

Conversation

@etrepum

@etrepum etrepum commented Jun 30, 2025

Copy link
Copy Markdown
Collaborator

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

vercel Bot commented Jun 30, 2025 •

Copy link
Copy Markdown

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

@zurfyx zurfyx left a comment •

Copy link
Copy Markdown
Member

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
// 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

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — cd84553b Deployed Jun 30, 2025 by vercel[bot]
Preview – lexical — cd84553b Deployed Jun 30, 2025 by vercel[bot]
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