Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mutate with replace klass #6089

Closed
wants to merge 6 commits into from
Closed

fix mutate with replace klass #6089

wants to merge 6 commits into from

Conversation

Piechota
Copy link
Contributor

When registering mutation check for Node that replaced original one.
mutation are a map so only one entry.

Should fix #4498

Copy link

vercel bot commented May 11, 2024

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 May 24, 2024 8:52am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 24, 2024 8:52am

@facebook-github-bot
Copy link
Contributor

Hi @Piechota!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 May 11, 2024
@etrepum
Copy link
Contributor

etrepum commented May 12, 2024

This looks like it solves the same problem as #6076 so it should close that as well if this PR is chosen. My review comments would be basically the same: #6076 (review)

@etrepum
Copy link
Contributor

etrepum commented May 12, 2024

I think this approach is probably better, but without really any docs or test coverage it's hard to say if there are any additional caveats to this simpler solution

@Piechota
Copy link
Contributor Author

In that other PR you have a good point about chain of node replacements.
Currently this code doesn't support it, I will fix it when I have a second.

@Piechota
Copy link
Contributor Author

Piechota commented May 12, 2024

So I have added loop to support multilevel replacement.
But I have problem testing it, it seems like right now it isn't supported really well.

Basically if node A replaces node B, and node C replaces node B. Creating node A doesn't create node C.
I think we should also loop over replace in $applyNodeReplacement()
But that's for different change.

@etrepum
Copy link
Contributor

etrepum commented May 12, 2024

Good idea, it seems that there is a lack of test coverage all around for this corner of the API!

@StyleT
Copy link
Contributor

StyleT commented May 13, 2024

If no-one picks this up - I'll look at it later to add some tests. I touched klasses already in the devtools

@aleksandr-lapushkin
Copy link

If no-one picks this up - I'll look at it later to add some tests. I touched klasses already in the devtools

That would be very welcome! I'll close #6076 since this one seems more in line with expectations.

Copy link

github-actions bot commented May 21, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 23.93 KB (0%) 479 ms (0%) 289 ms (-2.43% 🔽) 767 ms
packages/lexical-rich-text/dist/LexicalRichText.js 34.59 KB (0%) 692 ms (0%) 840 ms (-17.75% 🔽) 1.6 s
packages/lexical-plain-text/dist/LexicalPlainText.js 34.59 KB (0%) 692 ms (0%) 970 ms (-8.52% 🔽) 1.7 s

@StyleT
Copy link
Contributor

StyleT commented May 28, 2024

Closed in favor of #6189 (tests added)

@StyleT StyleT closed this May 28, 2024
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: registerMutationListener on replaced node
5 participants