Skip to content

Commit

Permalink
Apply PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
joemcgill committed Sep 22, 2023
1 parent a5922fe commit 3727709
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class WP_Theme_JSON_Resolver {
* Container to cache theme support data.
*
* @since n.e.x.t
* @var array
*/
protected static $theme_support_data = null;

Expand Down Expand Up @@ -627,7 +628,8 @@ public static function get_merged_data( $origin = 'custom' ) {
if (
null !== static::$merged[ $origin ]
&& static::has_same_registered_blocks( $cache_map[ $origin ] )
&& static::get_theme_supports_data() === static::$theme_support_data
// Ensure theme supports data is fresh before returning cached data for theme and custom origins.
&& ( ! in_array( $origin, array( 'theme', 'custom' ), true ) || static::get_theme_supports_data() === static::$theme_support_data )
) {
return static::$merged[ $origin ];
}
Expand All @@ -636,17 +638,25 @@ public static function get_merged_data( $origin = 'custom' ) {
$result->merge( static::get_core_data() );
if ( 'default' === $origin ) {
$result->set_spacing_sizes();

static::$merged[ $origin ] = $result;

return $result;
}

$result->merge( static::get_block_data() );
if ( 'blocks' === $origin ) {
static::$merged[ $origin ] = $result;

return $result;
}

$result->merge( static::get_theme_data() );
if ( 'theme' === $origin ) {
$result->set_spacing_sizes();

static::$merged[ $origin ] = $result;

return $result;
}

Expand Down

0 comments on commit 3727709

Please sign in to comment.