mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
Global styles: preload /global-styles
endpoint responses
This commit fixes a regression whereby requests to global styles endpoints were not being preloaded, resulting in several requests being fired clientside unnecessarily. For performance reasons, we preload the requests so that the data is in the editor store and ready to use straight away. The outcome is that the editor loads more quickly. Follow-up to [62042]. Props ellatrix, ramonopoly, apermo, peterwilsoncc. Fixes #62315. Built from https://develop.svn.wordpress.org/trunk@59316 git-svn-id: http://core.svn.wordpress.org/trunk@58702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
152661c1e7
commit
35264ca89c
@ -51,6 +51,8 @@ wp_enqueue_script( 'wp-edit-post' );
|
|||||||
|
|
||||||
$rest_path = rest_get_route_for_post( $post );
|
$rest_path = rest_get_route_for_post( $post );
|
||||||
|
|
||||||
|
$active_theme = get_stylesheet();
|
||||||
|
|
||||||
// Preload common data.
|
// Preload common data.
|
||||||
$preload_paths = array(
|
$preload_paths = array(
|
||||||
'/wp/v2/types?context=view',
|
'/wp/v2/types?context=view',
|
||||||
@ -65,8 +67,10 @@ $preload_paths = array(
|
|||||||
sprintf( '%s/autosaves?context=edit', $rest_path ),
|
sprintf( '%s/autosaves?context=edit', $rest_path ),
|
||||||
'/wp/v2/settings',
|
'/wp/v2/settings',
|
||||||
array( '/wp/v2/settings', 'OPTIONS' ),
|
array( '/wp/v2/settings', 'OPTIONS' ),
|
||||||
'/wp/v2/global-styles/themes/' . get_stylesheet(),
|
'/wp/v2/global-styles/themes/' . $active_theme . '?context=view',
|
||||||
|
'/wp/v2/global-styles/themes/' . $active_theme . '/variations?context=view',
|
||||||
'/wp/v2/themes?context=edit&status=active',
|
'/wp/v2/themes?context=edit&status=active',
|
||||||
|
array( '/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id(), 'OPTIONS' ),
|
||||||
'/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id() . '?context=edit',
|
'/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id() . '?context=edit',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -97,8 +97,9 @@ $preload_paths = array(
|
|||||||
'/wp/v2/template-parts?context=edit&per_page=-1',
|
'/wp/v2/template-parts?context=edit&per_page=-1',
|
||||||
'/wp/v2/themes?context=edit&status=active',
|
'/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 . '?context=edit',
|
||||||
'/wp/v2/global-styles/' . $active_global_styles_id,
|
array( '/wp/v2/global-styles/' . $active_global_styles_id, 'OPTIONS' ),
|
||||||
'/wp/v2/global-styles/themes/' . $active_theme,
|
'/wp/v2/global-styles/themes/' . $active_theme . '?context=view',
|
||||||
|
'/wp/v2/global-styles/themes/' . $active_theme . '/variations?context=view',
|
||||||
array( $navigation_rest_route, 'OPTIONS' ),
|
array( $navigation_rest_route, 'OPTIONS' ),
|
||||||
array(
|
array(
|
||||||
add_query_arg(
|
add_query_arg(
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.8-alpha-59315';
|
$wp_version = '6.8-alpha-59316';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user