Skip to content

Commit

Permalink
Only render the site editor canvas when the global styles are ready. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 19, 2021
1 parent 80e3447 commit 4d1b2dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/full-site-editing/edit-site-page.php
Expand Up @@ -192,7 +192,7 @@ static function( $classes ) {
'/wp/v2/themes?context=edit&status=active',
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
'/wp/v2/global-styles/' . $active_global_styles_id,
'/wp/v2/themes/' . $active_theme . '/global-styles',
'/wp/v2/global-styles/themes/' . $active_theme,
)
),
'initializer_name' => 'initializeEditor',
Expand Down
Expand Up @@ -135,7 +135,7 @@ function useGlobalStylesBaseConfig() {
).__experimentalGetCurrentThemeBaseGlobalStyles();
}, [] );

return baseConfig;
return [ !! baseConfig, baseConfig ];
}

function useGlobalStylesContext() {
Expand All @@ -144,7 +144,7 @@ function useGlobalStylesContext() {
userConfig,
setUserConfig,
] = useGlobalStylesUserConfig();
const baseConfig = useGlobalStylesBaseConfig();
const [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();
const mergedConfig = useMemo( () => {
if ( ! baseConfig || ! userConfig ) {
return {};
Expand All @@ -153,7 +153,7 @@ function useGlobalStylesContext() {
}, [ userConfig, baseConfig ] );
const context = useMemo( () => {
return {
isReady: isUserConfigReady,
isReady: isUserConfigReady && isBaseConfigReady,
user: userConfig,
base: baseConfig,
merged: mergedConfig,
Expand All @@ -165,6 +165,7 @@ function useGlobalStylesContext() {
baseConfig,
setUserConfig,
isUserConfigReady,
isBaseConfigReady,
] );

return context;
Expand Down

0 comments on commit 4d1b2dc

Please sign in to comment.