mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
Editor: Optimize preload paths for post and site editors.
This patch optimizes preload paths in post and site editors so that they match the real requests: - Remove the `/` preload as the payload is very big and the response is not needed on any critical path. - Modify the preloaded path for `/wp/v2/taxonomies` so that it corresponds to what `loadTaxonomyEntities` requests. After Gutenberg PR 37685 was merged to core, these preloads need to be modified to use `context=view` instead of `context=edit`. - Modify the `/wp/v2/users/me path` so that it matches the real request (no query params). - Add a preload of `/wp/v2/settings` because it is requested on critical path (editor boot). Site editor already preloads this, the changeset is only adding it to the post editor. This is related to Gutenberg PR 39256 which introduces compatibility code to modify the preload paths with a filter, when the Gutenberg plugin is active. See https://github.com/WordPress/gutenberg/pull/39256. Props jsnajdr, noisysocks. Fixes #55337. git-svn-id: https://develop.svn.wordpress.org/trunk@52995 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f3f27f414f
commit
3758272327
@ -57,16 +57,16 @@ $rest_path = rest_get_route_for_post( $post );
|
||||
|
||||
// Preload common data.
|
||||
$preload_paths = array(
|
||||
'/',
|
||||
'/wp/v2/types?context=edit',
|
||||
'/wp/v2/taxonomies?per_page=-1&context=edit',
|
||||
'/wp/v2/taxonomies?context=edit',
|
||||
'/wp/v2/themes?status=active',
|
||||
add_query_arg( 'context', 'edit', $rest_path ),
|
||||
sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
|
||||
sprintf( '/wp/v2/users/me?post_type=%s&context=edit', $post_type ),
|
||||
'/wp/v2/users/me',
|
||||
array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
|
||||
array( rest_get_route_for_post_type_items( 'wp_block' ), 'OPTIONS' ),
|
||||
sprintf( '%s/autosaves?context=edit', $rest_path ),
|
||||
'/wp/v2/settings',
|
||||
);
|
||||
|
||||
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
|
||||
|
@ -72,7 +72,6 @@ $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_global_styles_post_i
|
||||
$active_theme = wp_get_theme()->get_stylesheet();
|
||||
$preload_paths = array(
|
||||
array( '/wp/v2/media', 'OPTIONS' ),
|
||||
'/',
|
||||
'/wp/v2/types?context=edit',
|
||||
'/wp/v2/types/wp_template?context=edit',
|
||||
'/wp/v2/types/wp_template-part?context=edit',
|
||||
|
Loading…
x
Reference in New Issue
Block a user