From c99de18f954550c0ddf81c6b424f5700594f710f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Mon, 17 Jun 2024 09:40:27 +0200 Subject: [PATCH] Refill variations cache if blocks changed --- lib/class-wp-theme-json-resolver-gutenberg.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 25d900bdf4f797..85ccd7e19a326f 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -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 ]; }