-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Block Rename UI perf regression #55250
Conversation
Waiting on Perf test results... |
|
Size Change: +3 B (0%) Total Size: 1.65 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@scruffian can you compare the output you shared with that you would get from running the same tests against |
Makes sense and the perf test confirms it. |
On trunk:
|
We need to keep an eye on https://www.codevitals.run/project/gutenberg to see if the |
I also created this PR which proposes updating the docs on the |
Circling back here to confirm this PR fixed the perf regression. |
@getdave Today I independently discovered this issue when profiling for #54819, and I think there should be an even better fix. For a large post with approx 1000 blocks, we are currently wrapping every block with the But what if we didn't use the Alternatively, the rename UI doesn't need to be a plugin. It could be hardcoded directly into the Block Settings Menu, like, for example, |
I think ultimately, we need to better architecture all the built-in hooks we have (style, anchor, classname, rename, layout...). Most (if not all) don't need to use hooks and can be adde to the corresponding components, but if we ever do so, let's make sure we add them in an organized way :) |
I think what you suggest above is the most pragmatic option for now. This could be actioned in tandem with the follow up in #55194 to make metadata a default global attribute. |
What?
Fixes performance regression with selecting blocks identified in #54426 (comment).
Why?
Performance is good.
How?
Ensures that block renaming UI is only rendered for blocks which are seletected. Failure to do so leads to expensive slots being rendered for all blocks.
Perf tests caught this because it renders 1000 blocks 👏 👏 👏
Testing Instructions
Rename
(also in list view via same option).focus
minFocus
andmaxFocus
are all ~100ms (as per commit prior to the one which caused the regression)Also you can run the performance tests locally and compare the output on this branch vs
trunk
. The command is:You should notice that the
focus
metric goes down significantly betweentrunk
(regression) and this PR (proposed fix).Testing Instructions for Keyboard
Screenshots or screencast