-
Notifications
You must be signed in to change notification settings - Fork 115
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
Options do not return to dropdown on reset form, only after choosing another option #255
Comments
Hi @joaoesp I encountered the same problem even when not using react-hook-form. One potential solution is to provide the key prop to the Multiselect component, and this key should be modified each time you reset the form. This way, the Multiselect component will be re-initialized with its options when the form is reset. For Ex:
|
This is still the case for me. I don't have forms or Controllers in mine so a simple use of Multieselect in a div is enough to trigger it. This is very annoying especialy when you frequently select all the values and have nothing else to select to refresh the list. A very ugly workaround is that i set a counter in my state, and then when i want to clear the list i increase this counter, and then integrated this counter into the |
When I submit the form and use reset from react-hook-form to clear the form, the selected values from before do not get added to the list as part of reset, only when I choose another option it will refresh the dropdown list and add the previous selected values:
Codebox
Steps to reproduce: choose some options, press submit, open dropdown to see previous selected options missing.
Expected: previous selected options return to the dropdown right away on reset
Am I doing some wrong?
The text was updated successfully, but these errors were encountered: