facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
19.95k stars 1.7k forks source link

[lexical-mark] Bug Fix: Stop MarkNode __ids array deep copy in clone #6810

Closed ebads67 closed 2 weeks ago

ebads67 commented 2 weeks ago

Description

In this PR creation of a new __ids array is avoided in the clone function of the MarkNode, and the cloned MarkNode will have the same reference to__ids array of the original node. This has made an issue in the syncPropertiesFromYjs function where we compare the old and new nodes' properties, and only make an update to ydoc if the properties are changed. In the case MarkNodes, because the clone function deep-copies the __ids array the property comparison detects a change, despite the arrays being identical.

The fix is keeping the same __ids array in the cloned node, and only creating new __ids array when the array is modified.

vercel[bot] commented 2 weeks ago

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 Nov 8, 2024 11:41am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2024 11:41am
github-actions[bot] commented 2 weeks ago

size-limit report 📦

Path Size
lexical - cjs 29.94 KB (0%)
lexical - esm 29.75 KB (0%)
@lexical/rich-text - cjs 38.56 KB (0%)
@lexical/rich-text - esm 31.64 KB (0%)
@lexical/plain-text - cjs 37.18 KB (0%)
@lexical/plain-text - esm 28.95 KB (0%)
@lexical/react - cjs 40.35 KB (0%)
@lexical/react - esm 33.07 KB (0%)