-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
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
- Install fresh WP. I replicated this both with Gutenberg plugin and without it.
- Create a page with ~100 empty rows. Here is a code for this page https://gist.github.com/seriusokhatsky/f47743aa48767b3346ee1501c5a19fee
- Save and reload
- Do some random mouse moves and clicks between blocks.
- Run the Chrome Profiler and do a simple move up and down over the Blocks List. Stop the profiler.
- Search for
getEntityRecords
to see how many times it is called. VIDEO: https://gyazo.com/8ca28d5a4cd269030a3cbd88ed1bf41d
HOW TO FIX AND TEST.
- In the
wp-content/plugins/gutenberg-git/packages/editor/src/components/provider/use-block-editor-settings.js
add the line as shown on the screenshotreturn EMPTY_OBJECT;
https://i.gyazo.com/3cd214d54d3f4d4b1d9def80e290c0d3.png - 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