-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: preserve custom fields in Lexical-Yjs sync #6724
fix: preserve custom fields in Lexical-Yjs sync #6724
Conversation
When syncing Lexical selection to Yjs, custom fields in the local state were being dropped. This commit ensures all custom fields are preserved during the sync process, maintaining data integrity in collaborative editing scenarios. Updated syncLexicalSelectionToYjs to include ...customFields Ensures backwards compatibility with existing implementations Improves reliability of custom data persistence in collaboration
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
@@ -531,6 +532,7 @@ export function syncLexicalSelectionToYjs( | |||
focusPos, | |||
focusing, | |||
name, | |||
...customFields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a bit more efficient to use localState
instead, the customFields
variable isn't needed:
awareness.setLocalState({
...localState,
anchorPos,
awarenessData,
color,
focusPos,
focusing,
name,
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etrepum make sense, fixed!
When syncing Lexical selection to Yjs, custom fields in the local state were being dropped. This commit ensures all custom fields are preserved during the sync process, maintaining data integrity in collaborative editing scenarios.
Updated syncLexicalSelectionToYjs to include ...customFields Ensures backwards compatibility with existing implementations Improves reliability of custom data persistence in collaboration
prev PR where ProviderAwareness type was extended with
setLocalStateField