Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only render the site editor canvas when the global styles are ready. #36643

Merged
merged 2 commits into from Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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