Skip to content

Commit

Permalink
Refill variations cache if blocks changed
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jun 19, 2024
1 parent cdd91c9 commit c99de18
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,13 @@ protected static function get_style_variation_files() {
public static function get_style_variations( $scope = 'theme' ) {
$theme_dir = get_stylesheet_directory();
$locale = get_locale();
if ( isset( static::$style_variations_cache[ $theme_dir ][ $locale ][ $scope ] ) ) {

if (
isset( static::$style_variations_cache[ $theme_dir ][ $locale ][ $scope ] ) &&
// Variations depend on registered blocks.
null !== static::$blocks &&
static::has_same_registered_blocks( 'theme' )
) {
return static::$style_variations_cache[ $theme_dir ][ $locale ][ $scope ];
}

Expand Down

0 comments on commit c99de18

Please sign in to comment.