From 46c8871c9cafd3017b2c9afff9b36f0527c2205f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20M=C4=99drzycki?= Date: Fri, 9 Jul 2021 17:52:06 +0200 Subject: [PATCH] Re-render leaf when new properties were added to it (#4347) --- .changeset/sixty-ties-fetch.md | 5 +++++ packages/slate-react/src/components/leaf.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/sixty-ties-fetch.md diff --git a/.changeset/sixty-ties-fetch.md b/.changeset/sixty-ties-fetch.md new file mode 100644 index 000000000..fa25a8458 --- /dev/null +++ b/.changeset/sixty-ties-fetch.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Re-render leaf when new properties were added to it diff --git a/packages/slate-react/src/components/leaf.tsx b/packages/slate-react/src/components/leaf.tsx index 674a477c1..b3b7996ab 100644 --- a/packages/slate-react/src/components/leaf.tsx +++ b/packages/slate-react/src/components/leaf.tsx @@ -105,7 +105,7 @@ const MemoizedLeaf = React.memo(Leaf, (prev, next) => { next.renderPlaceholder === prev.renderPlaceholder && next.text === prev.text && next.leaf.text === prev.leaf.text && - Text.matches(next.leaf, prev.leaf) && + Text.equals(next.leaf, prev.leaf) && next.leaf[PLACEHOLDER_SYMBOL] === prev.leaf[PLACEHOLDER_SYMBOL] ) })