-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 Preview: Optimize default additional styles #59556
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +17 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
What?
This PR suggests that in
BlockPreview
we always default to the same empty array foradditionalStyles
if no other styles are specified.This is a complement to #58244.
Why?
Currently, every
BlockPreview
rerender without specifiedadditionalStyles
will cause a rerender, becauseadditionalStyles
will then default to a new array. Even after #58244 this continues to be a problem because a new fresh empty array will be passed fromBlockPreview
toAutoHeightBlockPreview
on every rerender when the block preview has no additional styles.I don't see a major performance impact, but this is still worth doing since this affects most block previews as they don't have additional styles.
How?
We're defaulting to the same empty array.
Similar to #58244, but for the parent component.
Potential follow-up: reusing the same
EMPTY_ADDITIONAL_STYLES
for both components.Testing Instructions
Verify block previews work still well for the inserter and patterns.
Testing Instructions for Keyboard
None
Screenshots or screencast
None