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 authored and noisysocks committed Nov 22, 2021
1 parent 62a8344 commit baa3050
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 @@ -183,7 +183,7 @@ function gutenberg_edit_site_init( $hook ) {
'/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 baa3050

Please sign in to comment.