-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 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
|
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.
Thanks, simple and effective 🙂
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.
Looks good, tests well, and makes sense! 👍
Thanks 🚀
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.
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
customClassName
controls to avoid callinguseBlockEditingMode
for 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