-
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 appender sync! subscriptions #58556
Conversation
Size Change: -13 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
// Avoid passing CustomAppender to useSelect because it could be a new | ||
// function on every render. | ||
const hasAppender = CustomAppender !== false; | ||
const hasCustomAppender = !! CustomAppender; |
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.
What's the difference between these two flags?
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.
I hoped the const name was descriptive 😄
One is to check if there's an appender in general: either CustomAppender === undefined or a component
The other is to check if there's a custom appender defined: CustomAppender must be a function (truthy)
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.
I guess the "undefined" is what tricked me
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.
I guess we should set a default to true
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.
Actually that won't work because we have another check CustomAppender ? ...
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.
I guess we could check boolean there, anyway I left it as is for now.
d7092ea
to
4744c99
Compare
What?
Removes 2 block editor store subscriptions for almost each inner block list.
Both of these subscriptions were sync subscriptions.
Why?
First run type -12.5%, second run -5.2%
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast