-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Prevent unnecessary execution of the displayValue
callback in the ComboboxInput
component
#3048
Conversation
This used to be re-executed every single render. This should typically not be an issue, but if you use non-deterministic code (E.g.: `Math.random`, `Date.now`, …) then it could result in incorrect values. Using `useMemo` allows us to only re-run it if the `data.value` or thte `displayValue` actually changes.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
displayValue
callbackdisplayValue
callback
cd97f2d
to
eed09b0
Compare
displayValue
callbackdisplayValue
callback in the ComboboxInput
component
We used to useMemo for |
Aha good catch! But yep just updated the When running: |
This PR fixes an issue where the
displayValue
on theComboboxInput
component is executed on every render. This PR fixes that by only executing the callback if either thevalue
or thedisplayValue
itself changes.This is especially useful if you have a
displayValue
that is a function that does some heavy computation or that contains undeterministic code. E.g.:Math.random()
,Date.now()
, …Fixes: #3044