Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#50606 closed enhancement (invalid)

Preload WordPress Rest index endpoint when loading core Gutenberg

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

Description

Related:
https://github.com/WordPress/gutenberg/pull/22952

Context:
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).

Proposal:
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 (3)

#1 @sabernhardt
4 years ago

  • Component changed from General to REST API

#2 @TimothyBlynJacobs
4 years 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?

#3 @hellofromTonya
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hello @jeremyyip,

Welcome to WordPress Core Trac!

I'm closing this ticket. Why? It's over 3 months since Timothy requested feedback and marked this ticket for close. But don't worry. You can reopen it to answer his question and continue the discussion.

Note: See TracTickets for help on using tickets.