Make WordPress Core

Changeset 53005


Ignore:
Timestamp:
03/28/2022 08:29:09 PM (2 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.
Merges [52995] to the 5.9 branch.

Location:
branches/5.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.9

  • branches/5.9/src/wp-admin/edit-form-blocks.php

    r52753 r53005  
    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
  • branches/5.9/src/wp-admin/site-editor.php

    r52594 r53005  
    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.