1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 12:30:11 +02:00

fix(slate-react): use Text.equals to compare leaf (#4175)

* fix(slate-react): use Text.equals to compare leaf

* refactor(slate-react): simplify MenoizedLeaf logic

* Create breezy-lizards-travel.md

* Update packages/slate-react/src/components/leaf.tsx

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
gyh9457
2021-08-06 01:42:41 +08:00
committed by GitHub
parent 13b3f9c783
commit bde6e80476
2 changed files with 5 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'slate-react': patch
---
Fixed a bug in the memoization logic for the leaves of text nodes.

View File

@@ -104,7 +104,6 @@ const MemoizedLeaf = React.memo(Leaf, (prev, next) => {
next.renderLeaf === prev.renderLeaf && next.renderLeaf === prev.renderLeaf &&
next.renderPlaceholder === prev.renderPlaceholder && next.renderPlaceholder === prev.renderPlaceholder &&
next.text === prev.text && next.text === prev.text &&
next.leaf.text === prev.leaf.text &&
Text.equals(next.leaf, prev.leaf) && Text.equals(next.leaf, prev.leaf) &&
next.leaf[PLACEHOLDER_SYMBOL] === prev.leaf[PLACEHOLDER_SYMBOL] next.leaf[PLACEHOLDER_SYMBOL] === prev.leaf[PLACEHOLDER_SYMBOL]
) )