Make WordPress Core

Opened 4 months ago

Last modified 6 days ago

#50606 new enhancement

Preload WordPress Rest index endpoint when loading core Gutenberg

Reported by: jeremyyip Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: REST API Keywords: close reporter-feedback
Focuses: performance Cc:



Data from WordPress REST endpoints can be preloaded before rendering the block editor. This allows us to ask the server to inject a response on the initial page load. It makes sense if the request will always be triggered on that page. The alternative is waiting for the page to load, waiting for scripts to execute, and then waiting for a response to the network request (which could have been preloaded).

Core already preloads the WordPress Rest index endpoint, but it does not account for variations request urls (like inclusion of query params).

Preload the /?context=edit index endpoint in core

Implementation Specifics:
Add /?context=edit to the list of paths to preload when loading core Gutenberg https://github.com/WordPress/WordPress/blob/f665e823a53f6b4205f37ff4e3222aacac3ed456/wp-admin/edit-form-blocks.php#L41-L53

Change History (2)

#1 @sabernhardt
3 weeks ago

  • Component changed from General to REST API

#2 @TimothyBlynJacobs
6 days ago

  • Keywords close reporter-feedback added

Thanks for the ticket @jeremyyip and welcome to trac!

The index endpoint doesn't support context at all. So really Gutenberg shouldn't be requesting this endpoint with a context specified at all. We would have to add an additional entry so that clients that are fetching the index without context would still have their requests preloaded.

Can this be fixed in the client?

Note: See TracTickets for help on using tickets.