-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Editor: preload settings requests (#66488)
Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
- Loading branch information
1 parent
aa2279b
commit 9a40ea0
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://github.com/WordPress/wordpress-develop/pull/7687 | ||
|
||
* https://github.com/WordPress/gutenberg/pull/66488 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* Preload necessary resources for the editors. | ||
* | ||
* @param array $paths REST API paths to preload. | ||
* @param WP_Block_Editor_Context $context Current block editor context | ||
* | ||
* @return array Filtered preload paths. | ||
*/ | ||
function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) { | ||
if ( 'core/edit-site' === $context->name ) { | ||
// Core already preloads both of these for `core/edit-post`. | ||
$paths[] = '/wp/v2/settings'; | ||
$paths[] = array( '/wp/v2/settings', 'OPTIONS' ); | ||
$paths[] = '/?_fields=' . implode( | ||
',', | ||
// @see packages/core-data/src/entities.js | ||
array( | ||
'description', | ||
'gmt_offset', | ||
'home', | ||
'name', | ||
'site_icon', | ||
'site_icon_url', | ||
'site_logo', | ||
'timezone_string', | ||
'url', | ||
) | ||
); | ||
} | ||
return $paths; | ||
} | ||
add_filter( 'block_editor_rest_api_preload_paths', 'gutenberg_block_editor_preload_paths_6_8', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9a40ea0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 9a40ea0.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11598140260
📝 Reported issues:
/test/e2e/specs/editor/various/taxonomies.spec.js
/test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js