Block Editor: Optimize 'customClassName' controls#55345
Conversation
|
Size Change: +1.39 kB (0%) Total Size: 1.66 MB
ℹ️ View Unchanged
|
8f0e7d6 to
171f92d
Compare
|
Flaky tests detected in 8f0e7d61d6fe43dae59fe481bf39f6a268ecd50f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6508289897
|
jsnajdr
left a comment
There was a problem hiding this comment.
Thanks, simple and effective 🙂
tyxla
left a comment
There was a problem hiding this comment.
Looks good, tests well, and makes sense! 👍
Thanks 🚀
tyxla
left a comment
There was a problem hiding this comment.
Something that came up while discussing these kinds of optimizations is that it could be worth adding a comment to describe what we're doing. Otherwise, it could be very easy to lose this optimization in a refactor.
|
@tyxla, can you link this conversation or an issue where I can follow-up on it? I’ve some thoughts as well. |
What?
A micro-optimization for
customClassNamecontrols to avoid callinguseBlockEditingModefor every block rendered in the editor.Why?
This check is only needed when the control is rendered for the selected block.
How?
Move controls and hook into a new component, which only renders when the feature is supported and block selected.
Testing Instructions
Additional CSS class(es)works as before.Screenshots or screencast