-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
useSelect: two code improvements #39975
Conversation
Size Change: -7 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
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 think the original name of trapSelect was not a typo but I think both are fine. cc @kevin940726
My own investigation also found that |
Two code improvements that I found when working on the
useSuspenseSelect
hook in #37261:onChange
function is exactly duplicated just a few lines above. Deduplicating that by callingonChange
directly.trapSelect
(renamed towrapSelect
because the old name seems to be a typo) now takes themapSelect
callback as a parameter, and doing the call with( registry.select, registry)
internally, instead of duplicating it on every call.