-
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
Throttle useSelect calls #26695
Throttle useSelect calls #26695
Conversation
The timing changes caused some tests to fail. Let's discuss this idea and I'll look into fixing the tests if it gets any traction. |
Size Change: +528 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
Cc @youknowriad. Most selectors already run async, except for the selected block's. I don't think we should delay it more than that. |
@ellatrix you mean the priority queue? How about only executing each selector once even if it's enqueued multiple times? |
See how gutenberg/packages/block-editor/src/components/block-list/index.js Lines 126 to 129 in 5f6514c
Only components down the tree of the currently selected block list item are processed in real-time, everything else is updated asynchronously, and only when there are free cycles left to process those datastore updates. The number of failing e2e tests is so huge that it should be a good indicator that it has a negative impact on the writing flow. In general, throttling has always been problematic when applied inside the editor. |
Makes sense, that's helpful feedback. I'll close this PR then. |
Description
I added a
console.log
statement toonStoreChange();
and opened the post editor. Then, I typed a single letter:Uh-oh!
Then I did the same with this PR applied:
Still not perfect, but much better!
How has this been tested?
Confirm all the tests pass
Types of changes
Bugfix
Checklist: