Editor: Stop re-rendering all blocks when navigating with arrow keys#11397
Editor: Stop re-rendering all blocks when navigating with arrow keys#11397
Conversation
tofumatt
left a comment
There was a problem hiding this comment.
👏
Niiiiiice. This is awesome; such an easy win.
I'm trying to understand when and why selection is being toggled such that it would have an impact here. Do you have more information? The way I understand it, |
Yes, it is effectively being disabled only for Image and Spacer blocks when resizing starts by dispatching |
Description
How has this been tested?
I tested it using React Dev Tools by enabling
Highlight Updatesoption in settings (see screencasts for details).Use arrow keys (up/down) to navigate between blocks and observe whether blocks re-render less often than before. In general, only previous and current block should change.
Solution
selectionStartClientIdis only used when selection is enabled (isSelectionEnabled). This PR ensure that the needed value is set only in the correct context.Screenshots
Before
After
Types of changes
Refactoring, no changes to the logic.