Make WordPress Core

Opened 2 months ago

Closed 2 months ago

#65636 closed defect (bug) (fixed)

Editor: Preload REST requests the post editor fetches on mount

Reported by: ellatrix Owned by: ellatrix
Priority: normal Milestone: 7.1
Component: Editor Version: 7.1
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Change History (2)

This ticket was mentioned in PR #11948 on WordPress/wordpress-develop by @ellatrix.


2 months ago
#1

  • Keywords has-patch added

## What?

Adds four entries to $preload_paths in wp-admin/edit-form-blocks.php:

  • /wp/v2/templates/lookup?slug=front-page: homepage actions (getDefaultTemplateId)
  • /wp/v2/taxonomies?context=edit: taxonomies panel
  • OPTIONS on the current post-type collection: canUser permission probe
  • /wp/v2/users/{author}?context=view&_fields=id,name: post-author display name

## 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=-1 queries (comments, wp_pattern_category) are deliberately not preloaded.

## Gutenberg counterpart

https://github.com/WordPress/gutenberg/pull/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.

#2 @ellatrix
2 months ago

  • Owner set to ellatrix
  • Resolutionfixed
  • Status newclosed

In 62749:

Editor: Preload REST API requests fetched on editor load.

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 https://github.com/WordPress/wordpress-develop/pull/11948.

Props ellatrix, mamaduka.
Fixes #65636.

Note: See TracTickets for help on using tickets.