Paragraph: store subscription for selected block only#56967
Conversation
|
Size Change: +81 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in f8e2b8c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7178178106
|
| </InspectorControls> | ||
| ) } | ||
| <InspectorControls group="typography"> | ||
| <DropCapControl |
There was a problem hiding this comment.
So you think the useSetting call is more expensive than rendering InspectorControls?
There was a problem hiding this comment.
oh the useSetting is only done for the selected block now. Makes sense.
There was a problem hiding this comment.
Yes, because (1) drop cap is supported by default and (2) individual InspectorControls instances no longer make select calls but read from context instead, so they're much cheaper.
|
Creative. :) |
What?
I know changing block for performance is generally frowned upon, but hear me out:
ParagraphRTLControl.InspectorControlsorBlockControlsso it's only for the select block: for example list item'sIndentUI.Why?
Every useSelect added to a (frequestly used) block will degrade the load and type bit. By moving it within InspectorControls, the subscription is now only added for the selected block(s).
How?
Moving it with InspectorControls ensures it's only added when the block is selected.
Testing Instructions
Load (first block)
First run: -4.25%
Second run: -3.85%
Testing Instructions for Keyboard
Screenshots or screencast