-
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
useBlockProps: combine store subscriptions #56847
Conversation
Size Change: -74 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
Flaky tests detected in 505a007. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7126509659
|
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.
Nice little improvement.
2e3891e
to
07ed00a
Compare
What?
This PR reduces the amount of store subscriptions per block by 7 (so per editor, times the amount of blocks).
It also combines two rich text useSelect calls, but that probably has no impact because it doesn't subscribe to the block editor store. It does remove a
useMemo
call though, so that's nice.Why?
Even though adding subscription handlers to the priority queue map should be super quick, there being a huge number for a large post means that lots of time is spent adding each of those. For a large post it seems like it's taking up half the work!
The only thing we can do, I think, is to reduce the amount of subscriptions per block. This PR reduces the number of subscriptions that need to be added on type by 20% (I logged the add method of
add
before and after).How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast