Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance#68898
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 <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: mmtr <mmtr86@git.wordpress.org>
…rmance (#68898) (#69251) * Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance * Use the loop, Luke! Unlinked contributors: ktmn. Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: mmtr <mmtr86@git.wordpress.org>
…rmance (WordPress#68898) * Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance * Use the loop, Luke! Unlinked contributors: ktmn. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: mmtr <mmtr86@git.wordpress.org>
|
@mmtr, @youknowriad, I've found another potential bottle next - #69631. |
…rmance (WordPress#68898) * Block Editor: Fix 'isBlockVisibleInTheInserter' selector helper performance * Use the loop, Luke! Unlinked contributors: ktmn. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: mmtr <mmtr86@git.wordpress.org>
What?
Resolves #68875.
Fixes recent performance regression in the Block Editor package.
Why?
The
isBlockVisibleInTheInserterfunction is often called even when the inserter isn't visible. The internal functiongetBlockParentsByBlockNameis a memoized selector but receives a newparentsarray 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