[lexical-website] Documentation Update: clarify Yjs custom node property syncing#8288
Merged
etrepum merged 1 commit intofacebook:mainfrom Apr 7, 2026
Merged
[lexical-website] Documentation Update: clarify Yjs custom node property syncing#8288etrepum merged 1 commit intofacebook:mainfrom
etrepum merged 1 commit intofacebook:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Apr 6, 2026
Comment on lines
+252
to
+257
| const repro = new URLSearchParams(window.location.search).get('repro'); | ||
|
|
||
| if (repro === '4493') { | ||
| return <Issue4493Repro />; | ||
| } | ||
|
|
Collaborator
There was a problem hiding this comment.
I don't think this is a good way to do this, would be better to handle it as a separate page entirely (you can see how pages are configured in vite.config.ts) or even to create a new package specifically for self-contained e2e tests.
There's also nothing that actually invokes this repro (I would expect it to be the subject of an e2e test), and it's related to a completely separate issue so it certainly doesn't belong in this PR.
etrepum
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #7280
This PR documents an important constraint of Lexical collaboration with Yjs: custom node properties are only reliably synced when they are own enumerable properties of the node.
To make that behavior clear for consumers implementing custom nodes without
NodeState, the docs now explain that node properties should be explicitly initialized in the constructor, even when the intended initial value isundefined. This avoids cases where optional properties are not present as own enumerable fields and therefore are not reliably synced during collaboration.The documentation also points readers toward
NodeStateas the preferred approach, since it avoids this class-property syncing pitfall and has better built-in support for collaboration use cases.What changed
NodeStateNodeStatewhere possibleWhy
Without this note, it is easy for consumers to define optional node properties using class field syntax and assume they will participate in collab syncing automatically. In practice, this can lead to confusing behavior because only own enumerable properties are reliably synchronized.
This PR makes that constraint explicit so custom node implementations are less likely to break in collaborative editors.
Test plan
Before
The relevant behavior existed, but it was easy to miss or misunderstand when implementing custom nodes for collaborative editing.
After
NodeState