Skip to content

[lexical] Chore: Change TabNode.setTextContent invariant to devInvariant#7855

Merged
etrepum merged 2 commits intofacebook:mainfrom
standardnotes:tab-node-error
Sep 24, 2025
Merged

[lexical] Chore: Change TabNode.setTextContent invariant to devInvariant#7855
etrepum merged 2 commits intofacebook:mainfrom
standardnotes:tab-node-error

Conversation

@amanharwara
Copy link
Copy Markdown
Contributor

Description

Currently, if the setTextContent method on TabNode is called with text that is not "\t" or "", it throws an error even in production. We had an issue where because we were using an older version of Lexical, some users' documents got into a state where their TabNodes had non-tab text content which got synced to the Y.Doc. And then when we upgraded to 0.32.1, where the invariant was added, those users' document weren't syncing correctly because the Yjs hook would recreate the TabNode and try to set the non-tab text content which then throws an error.

This PR changes the invariant to a devInvariant so that it only errors in development and only warns in production.

@meta-cla meta-cla 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 Sep 24, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Sep 24, 2025 10:36am
lexical-playground Ready Ready Preview Comment Sep 24, 2025 10:36am

@etrepum etrepum added this pull request to the merge queue Sep 24, 2025
Merged via the queue into facebook:main with commit 5c2f77d Sep 24, 2025
39 checks passed
@amanharwara amanharwara deleted the tab-node-error branch September 24, 2025 15:32
This was referenced Sep 25, 2025
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.

2 participants