Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#55337 closed defect (bug) (fixed)

Optimize preload paths for post and site editors

Reported by: jsnajdr's profile jsnajdr Owned by: audrasjb's profile audrasjb
Milestone: 5.9.3 Priority: normal
Severity: normal Version: 6.0
Component: Editor Keywords: has-patch fixed-major
Focuses: Cc:

Description

The preloaded REST responses (api-fetch preloading middleware) are a bit out of sync with the real requests that the post and site editors are sending, and they should be optimized them. See the description of the attached PR, and also of this Gutenberg PR (https://github.com/WordPress/gutenberg/pull/39256), for more details.

Change History (13)

This ticket was mentioned in PR #2387 on WordPress/wordpress-develop by jsnajdr.


2 years ago
#1

This patch optimizes preload paths in post and site editor 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 version that ships the https://github.com/WordPress/gutenberg/pull/37685 patch is merged to core, these preloads will need to be further 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's requested on critical path (editor boot). Site editor already preloads this, we're just adding it to the post editor.

This is companion to Gutenberg PR https://github.com/WordPress/gutenberg/pull/39256 which introduces compat code to modify the preload paths with a filter, when a Gutenberg plugin is active.

Fixes https://core.trac.wordpress.org/ticket/55337

#2 @noisysocks
2 years ago

  • Milestone changed from Awaiting Review to 5.9.3

Optimistically plopping this in 5.9.3 for if it happens but 6.0 would also be fine.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


2 years ago

#4 @audrasjb
2 years ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status changed from new to accepted

Self assigning for commit 👍

#5 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 52995:

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.
Fixes #55337.

#6 @audrasjb
2 years ago

  • Keywords fixed-major added; commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport consideration.

Before merging this to branch 5.9, @noisysocks shouldn't we also backport the changes introduced in the Gutenberg PRs mentioned above?

(ping @mamaduka)

#8 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Backported to branch 5.9 in [53005].

#9 @audrasjb
2 years ago

Oops. I forgot to make sure this can be backported. @noisysocks @mamaduka is it ok to backport it to branch 5.9 right now?

#10 @audrasjb
2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#11 @Mamaduka
2 years ago

@audrasjb, this looks good for backporting. Thanks.

#12 @jsnajdr
2 years ago

shouldn't we also backport the changes introduced in the Gutenberg PRs mentioned above?

The https://github.com/WordPress/gutenberg/pull/39256 PR doesn't need to be backported at all, because it just patches the preload paths with a filter, while this Core patch modifies the source. It's a compat code that will disappear during 6.0 release.

This patch should be safe to backport to 5.9 and will add value for 5.9 users: preloads will match what the block editor actually requests, while now some of them are futile.

#13 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Alright, thank you all.
The patch was backported to branch 5.9 in [53005], so I'm closing this ticket as fixed.

Note: See TracTickets for help on using tickets.