Skip to content

Interface performance issue related to reusable blocks and inserter #70666

@seriusokhatsky

Description

@seriusokhatsky

Description

This issue appears on most of our websites. Usually, when there are a lot of blocks and custom blocks are on the page and you edit the page for some time.
After extensive testing, I noticed that it is somehow related to the Inserter block and reusable blocks as discussed in this issue #64732

So to reproduce the issue with 2025 theme, I created a simple page with 100 empty rows with inserters. And after doing some random clicks and mouse moves for a minute, I see this interface lag. Then I profiled and noticed that when I move the mouse over the Blocks Tree List, it calls getEntityRecords an enormous number of times and causes this lag. It is just an example, but in real projects I saw a lot of performance lags in different places, and every time I saw these getEntityRecords calls.

Screenshots from the profiler:
https://i.gyazo.com/44316f3e8459f0639568ad193442f3ac.png

@Mamaduka, I tried to make the simplest test here. And maybe you can think that this issue is insignificant. But in combination with more complicated pages and blocks, the interface becomes unusable in some situations.

Step-by-step reproduction instructions

  1. Install fresh WP. I replicated this both with Gutenberg plugin and without it.
  2. Create a page with ~100 empty rows. Here is a code for this page https://gist.github.com/seriusokhatsky/f47743aa48767b3346ee1501c5a19fee
  3. Save and reload
  4. Do some random mouse moves and clicks between blocks.
  5. Run the Chrome Profiler and do a simple move up and down over the Blocks List. Stop the profiler.
  6. Search for getEntityRecords to see how many times it is called. VIDEO: https://gyazo.com/8ca28d5a4cd269030a3cbd88ed1bf41d

HOW TO FIX AND TEST.

  1. In the wp-content/plugins/gutenberg-git/packages/editor/src/components/provider/use-block-editor-settings.js add the line as shown on the screenshot return EMPTY_OBJECT; https://i.gyazo.com/3cd214d54d3f4d4b1d9def80e290c0d3.png
  2. Repeat steps 4-6.

Screenshots, screen recording, code snippet

No response

Environment info

  • Latest WP
  • Latest Gutenberg
  • Latest Google Chrome

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Priority] HighUsed to indicate top priority items that need quick attention[Type] PerformanceRelated to performance efforts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions