-
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: reduce getBlockEditingMode calls #58310
Conversation
4d8de63
to
3e744aa
Compare
Size Change: +69 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
hasOverlay: __unstableHasActiveBlockOverlayActive( | ||
clientId, | ||
blockEditingMode | ||
), |
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.
This is an unstable selector, so it seems ok to add optional parameters for now.
getBlockAttributes( state, clientId ), | ||
getBlockEditingMode( state, rootClientId ), | ||
getTemplateLock( state, rootClientId ) | ||
); |
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.
It's ok to get all these at once here: most blocks have attributes and have no parent template lock, so the previous early returns have no effect.
Flaky tests detected in b9d30ed. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7677690922
|
What?
We are currently calling
getBlockEditingMode
about ~78 000 times in the post editor for a large post (1400+ blocks) and ~168 000 in the site editor for that some post.This PR reduces to amount of calls to ~13 000 for the post editor and ~36 000 for the site editor.
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast