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

[lexical] Chore: Add more helpful invariants to $applyNodeReplacement #6567

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

etrepum
Copy link
Collaborator

@etrepum etrepum commented Aug 27, 2024

Description

Specifying the key argument incorrectly in a replacement function is a common mistake. This PR adds a helpful invariant and improves the error messages in the existing invariants for $applyNodeReplacement.

Test plan

Before

It was possible to write code that behaves incorrectly in subtle ways without a clear error message if you wrote a replacement function that preserved a node's __key incorrectly, e.g. https://discord.com/channels/953974421008293909/1278046226100654243

After

Invariants will throw an error early if this type of mistake is made with enough information to fix it.

Copy link

vercel bot commented Aug 27, 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 Sep 10, 2024 2:22pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 10, 2024 2:22pm

@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 Aug 27, 2024
Copy link

github-actions bot commented Aug 27, 2024

size-limit report 📦

Path Size
lexical - cjs 29.61 KB (0%)
lexical - esm 29.49 KB (0%)
@lexical/rich-text - cjs 38.14 KB (0%)
@lexical/rich-text - esm 31.3 KB (0%)
@lexical/plain-text - cjs 36.71 KB (0%)
@lexical/plain-text - esm 28.65 KB (0%)
@lexical/react - cjs 39.85 KB (0%)
@lexical/react - esm 32.79 KB (0%)

Merged via the queue into facebook:main with commit 46929e0 Sep 10, 2024
41 checks passed
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.

3 participants