Make WordPress Core

Changeset 52995


Ignore:
Timestamp:
03/25/2022 09:48:40 PM (3 years ago)
Author:
audrasjb
Message:

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.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-blocks.php

    r52752 r52995  
    5858// Preload common data.
    5959$preload_paths = array(
    60     '/',
    6160    '/wp/v2/types?context=edit',
    62     '/wp/v2/taxonomies?per_page=-1&context=edit',
     61    '/wp/v2/taxonomies?context=edit',
    6362    '/wp/v2/themes?status=active',
    6463    add_query_arg( 'context', 'edit', $rest_path ),
    6564    sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
    66     sprintf( '/wp/v2/users/me?post_type=%s&context=edit', $post_type ),
     65    '/wp/v2/users/me',
    6766    array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
    6867    array( rest_get_route_for_post_type_items( 'wp_block' ), 'OPTIONS' ),
    6968    sprintf( '%s/autosaves?context=edit', $rest_path ),
     69    '/wp/v2/settings',
    7070);
    7171
  • trunk/src/wp-admin/site-editor.php

    r52942 r52995  
    7373$preload_paths           = array(
    7474    array( '/wp/v2/media', 'OPTIONS' ),
    75     '/',
    7675    '/wp/v2/types?context=edit',
    7776    '/wp/v2/types/wp_template?context=edit',
Note: See TracChangeset for help on using the changeset viewer.