Repository navigation
Slow site editor when navigation block has multiple submenu items #68875
Copy link
Copy link
Closed
Labels
[Block] NavigationAffects the Navigation BlockAffects the Navigation Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] PerformanceRelated to performance effortsRelated to performance efforts
Description
Description
There is a performance issue in the site editor when editing a template that contains a navigation block with multiple submenu items.
The performance issue is practically unnoticeable by default, but it gets worse when activating plugins that register additional blocks (e.g. CoBlocks or WooCommerce).
Upon bisecting the latest changes, it seems that this is a regression introduced by #67734.
Step-by-step reproduction instructions
- Open the site editor
- Edit the navigation menu
- Add multiple submenu items:
- Save the changes and test the following scenarios.
Scenario 1 – A
- Active plugins: Gutenberg
- The performance issue is practically unnoticeable here.
Screen.Recording.2025-01-24.at.12.14.49.mov
Scenario 1 - B
- Active plugins: Gutenberg, CoBlocks
- The performance issue is way more noticeable now. When hovering a menu item, the submenu is not immediately visible. When selecting a block from the list view, it takes a long time for the block to be selected.
Screen.Recording.2025-01-24.at.12.15.38.mov
Scenario 1 - C
- Active plugins: Gutenberg, WooCommerce
- The site editor is almost unresponsive now. Hovering any block takes a long time to have some effect. Selecting a block from the list view takes an even longer time
Screen.Recording.2025-01-24.at.12.19.14.mov
Scenario 2 – A
- Active plugins: Gutenberg with 8042535 reverted
- Since the issue was practically unnoticeable before, no difference can be observed
Screen.Recording.2025-01-24.at.12.25.44.mov
Scenario 2 - B
- Active plugins: Gutenberg with 8042535 reverted, CoBlocks
- The performance issue is gone
Screen.Recording.2025-01-24.at.12.27.47.mov
Scenario 3 - C
- Active plugins: Gutenberg with 8042535 reverted, WooCommerce
- The performance issue is gone
Screen.Recording.2025-01-24.at.12.29.33.mov
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 6.7.1, Gutenberg 20.1.0, Twenty Twenty-Three
- Chrome
- Desktop with macOS Sequoia 15.2
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Block] NavigationAffects the Navigation BlockAffects the Navigation Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] PerformanceRelated to performance effortsRelated to performance efforts
Type
Projects
- StatusShow more project fields✅ Done
Activity
youknowriad commentedon Jan 24, 2025
cc @Mamaduka just in case it becomes an issue for 6.8 as well. I confirm that I reproduce the issue as well.
ktmn commentedon Jan 24, 2025
I can produce a performance degradation with WC active in
post-editor, only using blockscore/groupandcore/paragraph.core/groupnested 20x with 2xcore/paragraphblocks in the center.is-highlightedclass to the blocks, re-rendering them).Initially it will render promptly, the block that gets hovered and the block that loses hover both render in ~0.3ms (Component):
Now the blocks that receive and lose hover in the list view render significantly longer, ~4ms here:
Here are the blocks for testing:
Some actions can fix it as well, like adding some more blocks, or deleting some, sometimes fixes it for some time, and then it slugs down again. Very odd.
Mamaduka commentedon Jan 27, 2025
@mmtr, were you able to track down which types of block this affects?
Looking at the Jetpack hotfix PR, it seems the bottleneck is the
getBlockParentsByBlockName, a memoized selector that receives a newparentsarray reference on every call, which can affect the memory.mmtr commentedon Jan 27, 2025
@Mamaduka I didn't. I always use the "Submenu" block to check the overall performance because the degradation is immediately noticeable with that block, but I have no idea about other types of block.
My guess is that all blocks that require a specific parent block to be inserted are the ones more affected.
Mamaduka commentedon Jan 27, 2025
@mmtr created the initial pass for the fix #68898. Let me know if that fixes an issue with WooCommerce.
I think they're more "paper-cut" regressions related to the inserter selector performance. For example, the
hasInserterItemsalso shows up in performance profiles.mmtr commentedon Jan 28, 2025
It does!
Screen.Recording.2025-01-28.at.13.09.36.mov