-
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
Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance #68898
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @ktmn. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +11 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
It would be cool to be able to catch this kind of regression in the perf metrics at some point (maybe we should add a nested navigation block or something) |
100%. Maybe a separate metric to avoid accidentally affecting other metrics. |
@youknowriad, @mmtr, is this good to merge? |
This fixes the issue for me when I test locally with both CoBlocks and WooCommerce active: Screen.Recording.2025-01-28.at.13.09.36.mov |
Thanks for the confirmation and for providing the patch in the hotfix ticket! |
…rmance (#68898) * Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance * Use the loop, Luke! Unlinked contributors: ktmn. Co-authored-by: Mamaduka <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: mmtr <[email protected]>
…rmance (#68898) (#69251) * Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance * Use the loop, Luke! Unlinked contributors: ktmn. Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: mmtr <[email protected]>
What?
Resolves #68875.
Fixes recent performance regression in the Block Editor package.
Why?
The
isBlockVisibleInTheInserter
function is often called even when the inserter isn't visible. The internal functiongetBlockParentsByBlockName
is a memoized selector but receives a newparents
array reference on every call.Calling a memoized selector with an unstable argument reference can degrade performance.
Testing Instructions
Notes:
Testing Instructions for Keyboard
Same.
Screenshots or screencast