Skip to content

Conversation

@jsnajdr
Copy link
Member

@jsnajdr jsnajdr commented Apr 25, 2022

Follow-up to #39256 where I modify the gutenberg_optimize_preload_paths filter to patch preload_paths only for the Post Editor page (core/edit-post). For any other page, like the Site or Widgets Editor, the filter now leaves the preload_paths intact.

Fixes a bug that @fullofcaffeine and @david-binda discovered when deploying latest Gutenberg on WordPress.com.

@jsnajdr jsnajdr added the [Type] Performance Related to performance efforts label Apr 25, 2022
@jsnajdr jsnajdr self-assigned this Apr 25, 2022
@gziolo
Copy link
Member

gziolo commented Apr 30, 2022

Is it something that should get included in WP 6.0?

@gziolo gziolo added the REST API Interaction Related to REST API label Apr 30, 2022
@jsnajdr
Copy link
Member Author

jsnajdr commented Apr 30, 2022

Is it something that should get included in WP 6.0?

Yes, it would be nice to have there.

@gziolo gziolo added the [Type] Bug An existing feature does not function as intended label Apr 30, 2022
@jsnajdr jsnajdr force-pushed the update/optimize-preload-improve branch 2 times, most recently from ac1be53 to 1d4b8af Compare May 1, 2022 06:29
@jsnajdr jsnajdr force-pushed the update/optimize-preload-improve branch from 1d4b8af to c8bc405 Compare May 1, 2022 06:59
@ndiego
Copy link
Member

ndiego commented May 17, 2022

Given that RC3 is scheduled for today, I am going to move this to the 6.0.1 Project Board.

@Mamaduka
Copy link
Member

I just checked core patch for initial PR. There's a single change to the Side Editor preload paths and no changes for the Widgets Editor. So I don't think this needs backporting.

function gutenberg_optimize_preload_paths( $preload_paths ) {
function gutenberg_optimize_preload_paths( $preload_paths, $block_editor_context ) {
// optimize only the post editor page, not site or widgets.
if ( 'core/edit-post' !== $block_editor_context->name ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( 'core/edit-post' !== $block_editor_context->name ) {
if ( isset( $block_editor_context->name ) && 'core/edit-post' !== $block_editor_context->name ) {

The name property doesn't exist in WP >= 5.9, need to include a check to avoid PHP notice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the min requirement 5.9 now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's WP 6.0, so I don't think we need these changes anymore. See my previous comment - #40587 (comment).

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a small comment, but otherwise, this looks good to me 👍

@Mamaduka
Copy link
Member

I think we can close this PR. WP 6.0 compat is no longer required by the plugin.

@t-hamano
Copy link
Contributor

The current Gutenberg plugin requires WP6.3 or higher. Furthermore, there is no block_editor_rest_api_preload_paths hook itself in the project. Therefore, I would like to close this PR.

@t-hamano t-hamano closed this Dec 19, 2023
@johnbillion johnbillion deleted the update/optimize-preload-improve branch April 22, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended [Type] Performance Related to performance efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants