-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Autocomplete] Multiple async selection + react-hook-form causes inconsistent view #44553
Comments
hey can you please assign this issue to me, still this i tried to solve it. |
Fixed Let me know if you have any further questions! |
@Harsh517-tech415 Hey thanks for investigating this ~ In your sandbox, there is a tiny bug here on this line: https://codesandbox.io/p/sandbox/autocomplete-rhf-forked-35mn47?file=%2Fsrc%2Fhelpers%2FuseDebounceHook.ts%3A28%2C19-28%2C63 -delay: (prev as DebounceSearch).delay - 100,
+delay: (prev as DebounceSearch)?.delay - 100, Otherwise, it does seems to fix this:
@Michele-Masciave does this work for you? |
Thanks both @mj12albert @Harsh517-tech415 it (almost) works for me... what I still noticed is that it is possible to select an already selected option, but I think that I can figure out how to fix it. |
Playing with filterOptions the problem mentioned above is solved.
|
great 👍 |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @Michele-Masciave How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Steps:
Current behavior
Expected behavior
Context
I'm implementing an async type ahead using the Autocomplete component and react-hook-form. While for the static standard/multiple implementation it was quite straight, I'm dealing with the following issue for the async multiple case.
The value looks not consistent between the Form and the view.
Besides the debounce logic that can be simplified, I tried also to save the selected values
onChange
in a new state to simultaneously maintain value and options, but I'm still not able to see the selected options in the autocomplete.Your environment
Running on a nodebox.
Search keywords: autocomplete, multiple, react-hook-form
The text was updated successfully, but these errors were encountered: