-
Notifications
You must be signed in to change notification settings - Fork 4.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
Block: Avoid rerendering when the previous/next block updates #5025
Conversation
It looks like in all places we use |
Nice idea! I saw these light up in React Dev Tools Highlight Updates as well 😄 Could you give the branch a rebase? Will take a look later this morning. |
b19542a
to
124ea5d
Compare
Rebased, thanks @aduth |
@@ -57,8 +57,8 @@ import { | |||
isMultiSelecting, | |||
getBlockIndex, | |||
getEditedPostAttribute, | |||
getNextBlock, | |||
getPreviousBlock, | |||
getNextBlockUid, |
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.
We need to come to a convention on camel-case for abbreviations. Elsewhere I've used e.g. rootUID
Related: #2511
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.
Right! I thought we kind of agreed on always camel casing abbreviations at some point but happy to change anyway.
Regression of #5025, where prop was changed from `previousBlock` to `previousBlockUid`, but neglected to update the instance of the prop reference in keydown handler
* Block List: Fix select previous on backspace behavior Regression of #5025, where prop was changed from `previousBlock` to `previousBlockUid`, but neglected to update the instance of the prop reference in keydown handler * Utils: Improve spec compliancy of text field * Block: Prefer focus text field on selection, fallback to wrapper * Writing Flow: Refactor getClosestTabbable to support non-tabbable target * Block List: Extract typing monitor to separate component * Block List: Don't deselect block on escape press Escape doesn't clear focus, so causes problems that block is not selected but retains focus (since isSelected state is synced with focus) * Block List: Fix delete or insert after focused block wrapper node * Rich Text: Ensure format toolbar manages its own dismissal Previously only closed on esc when editing link, not adding new link TODO: Consolidate editing state
the
getPreviousBlock
andgetNextBlock
selectors are causing the block to rerender if its previous/next block changes. This is unnecessary because we only need these blocks for "merge" behaviors.This PR updates the merge behavior to rely on UIDs instead of the whole object.
Testing instructions