Skip to content

Conversation

@aduth
Copy link
Member

@aduth aduth commented Feb 14, 2018

This pull request seeks to optimize the rendering of the WritingFlow component by removing its dependency on the selectedBlock object in favor of a selectedBlockUID string, which is all it uses anyways. Since the object form can change references frequently, this was causing unnecessary renders.

With these changes, the only component re-rendering within VisualEditor when a block changes is the block itself.†

† Caveat being there's still one other outside: The Inserter component.

Testing instructions:

Verify there are no regressions in the behaviors covered by these changes:

  • Shift-expanding to multi-select a preceding or following block
  • Finding and shifting focus into the first focusable node on a block becoming selected

Since the object form can change references frequently, causes unnecessary renders
@aduth aduth added [Type] Performance Related to performance efforts [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Feb 14, 2018
@aduth aduth added this to the 2.2 milestone Feb 15, 2018
@aduth
Copy link
Member Author

aduth commented Feb 15, 2018

Noting that this incidentally resolves an error described at #5046 (comment) .

While the error will no longer occur, no multi-selection will take place, which is potentially confusing because the caret continues to blink. I imagine part of the issue is that unselecting a block should also blur.

From what I can tell, this might be a regression of #4872, specifically the behavior here which had called blur when focus changed to false:

https://github.com/WordPress/gutenberg/pull/4872/files#diff-766381e792acf9d4c2505f3aeddcca7eL756

(cc @youknowriad)

@aduth aduth merged commit 08cba69 into master Feb 16, 2018
@aduth aduth deleted the update/writing-flow-selected-block-uids branch February 16, 2018 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Performance Related to performance efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants