-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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(slate-react): use Text.equals to compare leaf #4175
Conversation
🦋 Changeset detectedLatest commit: 9338c95 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -92,7 +92,7 @@ const MemoizedLeaf = React.memo(Leaf, (prev, next) => { | |||
next.renderLeaf === prev.renderLeaf && | |||
next.text === prev.text && | |||
next.leaf.text === prev.leaf.text && | |||
Text.matches(next.leaf, prev.leaf) && | |||
Text.equals(prev.leaf, next.leaf, { loose: true }) && |
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.
Great catch @gyh9457! Would it be possible to remove the previous line now (and the loose
option) to simplify the logic even further. Instead of:
next.text === prev.text &&
next.leaf.text === prev.leaf.text &&
Text.equals(prev.leaf, next.leaf, { loose: true }) &&
We'd have:
next.text === prev.text &&
Text.equals(prev.leaf, next.leaf) &&
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.
done @ianstormtaylor
Part of this was handled in #4347. Need to decide if we can safely also remove |
* 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>
Description
fix
MenoizedLeaf
functionIssue
Example
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)