Skip to content

Refactor gutenberg_initialize_editor function and remove block_editor_preload_data filter - #35838

Merged
anton-vlasenko merged 6 commits into
trunkfrom
fix/remove-block_editor_preload_data-filter
Oct 25, 2021
Merged

Refactor gutenberg_initialize_editor function and remove block_editor_preload_data filter#35838
anton-vlasenko merged 6 commits into
trunkfrom
fix/remove-block_editor_preload_data-filter

Conversation

@anton-vlasenko

@anton-vlasenko anton-vlasenko commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

Description

This PR is a follow-up to #24642.
Fixes #35803
We've added block_editor_preload_data filter to the gutenberg_initialize_editor function in the scope of #35402.
This filter is only needed to provide data for the createMenuPreloadingMiddleware.
It's not the best solution because we don't want to add filters whose only task is to solve a specific (single) issue.
We can do better.
We need to refactor gutenberg_initialize_editor to not use that filter.

How has this been tested?

  1. Open the navigation page (wp-admin/admin.php?page=gutenberg-navigation).
  2. Make sure that the first menu from the list of menus is selected as the current menu.
  3. Make sure there is only 1 fetch/XHR request (see the screenshot below), meaning that the preloading is working.

Screenshots

Screenshot 2021-10-06 at 17 29 11

Screenshots

Types of changes

New feature

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@anton-vlasenko anton-vlasenko changed the title [WIP] Fix/remove block editor preload data filter Refactor gutenberg_initialize_editor function and remove block_editor_preload_data filter Oct 22, 2021
@anton-vlasenko
anton-vlasenko force-pushed the fix/remove-block_editor_preload_data-filter branch from c6bba65 to 81ebbe6 Compare October 22, 2021 13:19
@anton-vlasenko anton-vlasenko added this to the Gutenberg 11.8 milestone Oct 22, 2021
@anton-vlasenko

anton-vlasenko commented Oct 22, 2021

Copy link
Copy Markdown
Contributor Author

@TimothyBJacobs @spacedmonkey
Could you please review this pull request, so we don't ship Gutenberg with the block_editor_preload_data filter?

@anton-vlasenko
anton-vlasenko force-pushed the fix/remove-block_editor_preload_data-filter branch from 479de19 to 95fa26b Compare October 22, 2021 15:06
@anton-vlasenko anton-vlasenko self-assigned this Oct 22, 2021

@TimothyBJacobs TimothyBJacobs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks this looks great!

@anton-vlasenko
anton-vlasenko merged commit e99df03 into trunk Oct 25, 2021
@anton-vlasenko
anton-vlasenko deleted the fix/remove-block_editor_preload_data-filter branch October 25, 2021 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor gutenberg_initialize_editor function and remove block_editor_preload_data filter

2 participants