Editor: Preload REST requests the post editor fetches on mount#11948
Editor: Preload REST requests the post editor fetches on mount#11948ellatrix wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
@ellatrix Should this PR be committed to 7.1? |
|
I would appreciate it if you could proceed with this PR and commit it in time for the 7.1 Beta1 release on July 15. |
…rwise fetch post-mount.
Adds four entries to `\$preload_paths` in `wp-admin/edit-form-blocks.php`:
* `/wp/v2/templates/lookup?slug=front-page` — used by the editor's
homepage actions gate (`shouldShowHomepageActions`).
* `/wp/v2/taxonomies?context=edit` — read by the post-taxonomies
sidebar panel; non-paginated endpoint with a small bounded payload.
* `OPTIONS` for the current post-type collection — collection-level
permission probe.
* `/wp/v2/users/{author}?context=view&_fields=id,name` — read by the
post-author panel.
Each of these is captured today as a post-mount network fetch by
Gutenberg's post-editor preload e2e spec; preloading them eliminates
those requests from the boot path.
eafee24 to
35ac2d2
Compare
Add four entries to the block editor preload paths in `wp-admin/edit-form-blocks.php`: the front-page template lookup, the taxonomies list, the `OPTIONS` permissions request for the post type collection, and, for post types that support it, the post author's display name. The editor previously requested all of these over the network on first load. Developed in #11948. Props ellatrix, mamaduka. Fixes #65636. git-svn-id: https://develop.svn.wordpress.org/trunk@62749 602fd350-edb4-49c9-b593-d223f7449a82
Add four entries to the block editor preload paths in `wp-admin/edit-form-blocks.php`: the front-page template lookup, the taxonomies list, the `OPTIONS` permissions request for the post type collection, and, for post types that support it, the post author's display name. The editor previously requested all of these over the network on first load. Developed in WordPress/wordpress-develop#11948. Props ellatrix, mamaduka. Fixes #65636. Built from https://develop.svn.wordpress.org/trunk@62749 git-svn-id: http://core.svn.wordpress.org/trunk@62033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Adds four entries to
$preload_pathsinwp-admin/edit-form-blocks.php:/wp/v2/templates/lookup?slug=front-page: homepage actions (getDefaultTemplateId)/wp/v2/taxonomies?context=edit: taxonomies panelOPTIONSon the current post-type collection:canUserpermission probe/wp/v2/users/{author}?context=view&_fields=id,name: post-author display name (only when the post type supports author)Why?
The post editor fetches all four on first mount. Preloading them serves the data from the inline cache and removes network round-trips from the boot path. Unbounded
per_page=-1queries (comments,wp_pattern_category) are deliberately not preloaded.Gutenberg counterpart
WordPress/gutenberg#78565
Trac ticket
https://core.trac.wordpress.org/ticket/65636
Testing
Gutenberg's preload spec (
test/e2e/specs/preload/post-editor.spec.js) asserts these URLs no longer fire as post-mount network requests.