Update preload paths for post, site and widgets editors #2531
+12
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes the REST endpoints that get preloaded when displaying a page for post, site and widgets editor, so that they are in sync with what the latest version of Gutenberg to be shipped with Core 6.0 really requests.
This patch finished backport of the
gutenberg_optimize_preload_pathsfilter in Gutenberg, and that filter can be removed after this is merged. Trac ticket: https://core.trac.wordpress.org/ticket/55505Post Editor
The
typesandtaxonomiesrequests havecontextchanged fromedittoview, because these requests were modified in WordPress/gutenberg#37685.Adding two new preloads: list of reusable blocks (
wp_blockpost type, loaded from/wp/v2/blocks) and permissions for creating pages (OPTIONS /wp/v2/pages). Both requests are made in theuseBlockEditorSettingshook, at the top of the post editor React tree.Site Editor
Like in Post Editor, modify the
typesrequestcontextfromedittoview.The
taxonomiespreload, together with four other ones, can be removed because the Site Editor doesn't request that data.Site Editor also doesn't need to preload
/wp/v2/settings. These are used only in specialized blocks like Site Title, and by theuseTitlehook which is by no means on critical path.Widgets Editor
Adds a preload for the
/wp/v2/widget-typesendpoint requested by theregisterLegacyWidgetVariationscalled during initialization.