SelectSearch ignores not changed value after async onChange
See original GitHub issueHi!
It seems that SelectSearch ignores not updated value
prop after async onChange
.
Let say the value is ‘1’, onChange calls API and (after validation or whatever reason) value didn’t actually update then SelectSearch still shows previously clicked option as a selected one. Which is wrong. So it looks like the internal state is not updated and it mismatches with the provided value from now on.
My workaround is to use a key
prop but it’s masking the actual problem in the end. 🤷🏻
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Returning correct value using react-select and react-hook-form
This solution had a problem with the onChange function for me - what fixed it was using render={({ field }) and then on...
Read more >react-select-search - Bountysource
It seems that SelectSearch ignores not updated value prop after async onChange . Let say the value is '1', onChange calls API and...
Read more >SCR19: Using an onchange event on a select element ... - W3C
Navigate to the trigger select element, navigate through the options but do not change the value. Check that the matching option values are...
Read more >React Select Options Array
Called when select an option or input value change, or value of input is ... How To Get Input Value In JavascriptThe following...
Read more >React Select Options Array - Azienda Roberto e Nicola Ercolani
How To Get Input Value In JavascriptThe following example displays the. ... React Select onChange, how to change one value of an array...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the late reply @Ronny25 . Yes, seems like something has broken with the controllable state. I’ll take a look
@icaroscherma
onSelect
will be triggered only whenvalue
has changed - it means when it’s a primitive string it won’t detect change (when it has previous value). So I would maybe stick to usingkey
prop. Seems a bit cleaner as for me instead of using additional state or monkeypatching. Thanks.