-
Notifications
You must be signed in to change notification settings - Fork 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
Combobox's onChange
also fires on no change
#3202
Comments
Hey! That should definitely not be the case, my guess is that you are defining an array of objects inside your render function and therefore each option is going to be a new instance of the object every time the component rerenders. Can you share a minimal reproduction repo? |
Hey! Going to close this one since we haven't heard back, but feel free to reopen a new issue if you're able to provide a minimal reproduction of this 👍 |
@RobinMalfait ah, will do, I had not found the time just yet. Your guess kind of helped in that indeed each option is a new instance (we use Combobox as a autosuggest) and that would explain firing |
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
2.0.3
What browser are you using?
Safari, Firefox
Describe your issue
Acoording to the docs, the
onChange
prop of aCombobox
…If a user clicks outside the Combobox without having selected an option, or when the user selects the same option that was already selected, the
onChange
handler also fires.It's easy enough to work around, but it feels like the handler should only fire on an actual change :)
The text was updated successfully, but these errors were encountered: