[wp-trac] [WordPress Trac] #62291: Reuse block metadata in WP_Theme_JSON::get_valid_block_style_variations() for better performance
WordPress Trac
noreply at wordpress.org
Wed Nov 6 00:42:27 UTC 2024
#62291: Reuse block metadata in WP_Theme_JSON::get_valid_block_style_variations()
for better performance
-------------------------+--------------------------
Reporter: mukesh27 | Owner: mukesh27
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.8
Component: Editor | Version: 6.6
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: performance
-------------------------+--------------------------
Changes (by ramonopoly):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"59359" 59359]:
{{{
#!CommitTicketReference repository="" revision="59359"
Performance: reuse block metadata in
`WP_Theme_JSON::get_valid_block_style_variations()`
In `WP_Theme_JSON::get_valid_block_style_variations()`, the method was
calling `self::get_blocks_metadata()` even though the metadata was already
retrieved in the parent function. This update reuses the existing block
metadata instead of calling it again.
A new optional parameter, `$blocks_metadata`, has been added to the
function, allowing it to use pre-fetched metadata when available,
improving efficiency.
Fewer `self::get_blocks_metadata()` calls mean faster processing,
especially in themes with many blocks.
Props mukesh27, ramonopoly, aaronrobertshaw, flixos90.
Fixes #62291.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62291#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list