diff --git a/lib/compat/wordpress-6.8/preload.php b/lib/compat/wordpress-6.8/preload.php index 16aeb4a50619f..aabe0d4fb574c 100644 --- a/lib/compat/wordpress-6.8/preload.php +++ b/lib/compat/wordpress-6.8/preload.php @@ -17,10 +17,7 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) { } } - // Core already preloads both of these for `core/edit-post`. - // To do: investigate why adding this preload path breaks the site - // editor in Safari ("template not found"). Perhaps a race condition? - // $paths[] = '/wp/v2/settings'; + $paths[] = '/wp/v2/settings'; $paths[] = array( '/wp/v2/settings', 'OPTIONS' ); $paths[] = '/?_fields=' . implode( ',', diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index a3bbd37f2d7c2..ae0c7f456e533 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -749,12 +749,13 @@ export const getNavigationFallbackId = export const getDefaultTemplateId = ( query ) => - async ( { dispatch, registry } ) => { - const response = await apiFetch( { + async ( { dispatch, registry, resolveSelect } ) => { + const template = await apiFetch( { path: addQueryArgs( '/wp/v2/templates/lookup', query ), - parse: false, } ); - const template = await response.json(); + // Wait for the the entities config to be loaded, otherwise receiving + // the template as an entity will not work. + await resolveSelect.getEntitiesConfig( 'postType' ); // Endpoint may return an empty object if no template is found. if ( template?.id ) { registry.batch( () => {