-
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
Theme JSON: remove redundant check and relocate $selectors assignment #66154
Conversation
…_Theme_JSON::get_blocks_metadata()` is only called if necessary. This also improves wp_add_global_styles_for_blocks as it calls WP_Theme_JSON::get_styles_block_nodes().
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. |
Flaky tests detected in 733842a. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11358995225
|
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 for cleaning this up @ramonjd 👍
✅ Changes make sense
✅ Smoke tested in TT4, TT5, and Emptytheme
CI tests should pass.
We'll need a backport log for that to happen 🙂
LGTM though 🚢
This also has the potential to slightly improve the performance of functions such as wp_add_global_styles_for_blocks
As a side note, there is an open PR around using a transient for caching global styles for blocks in wp_add_global_styles_for_blocks
.
Ha, on it. Thanks |
…WordPress#66154) Remove redundant check for `$theme_json['styles']`,` which means `WP_Theme_JSON::get_blocks_metadata()` is only called if necessary. This also has the potential to slightly improve the performance of functions that call WP_Theme_JSON::get_styles_block_nodes(), where no block styles exist Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
What? Why? How?
Remove redundant check for
$theme_json['styles']
, which meansWP_Theme_JSON::get_blocks_metadata()
is only called if necessary.This also has the potential to slightly improve the performance of functions such as wp_add_global_styles_for_blocks that call
WP_Theme_JSON::get_styles_block_nodes()
, where no block styles exist.Testing Instructions
CI tests should pass.
Smoke test in a block theme with lots of block styles, like TT4 and a theme with none, like Emptytheme