Is there a way to set the inputValue via props when using asyncOptions
My scenario is that I fetch options from web service, label and value. I then select the options, handle the change and keep value in store. The value of the select is being set via the value property, which when it changes to the value (id) to replaces the value of the input, then triggers another async call to find values using the value in the input (which is now the id).
Is there a way of setting the value and inputValue so the inputValue doesn't get changed to the ID and trigger call to ayncOptions? I don't want to do a fetch against the remote item, when I already have the value and label in the store.
Thanks
When the react-select component is fed a value prop on initial render (consider a parent component's getInitialState feeding in an empty string), and then a call to some backend service is launched and changes the value in the parent state to be an option object - the asyncOptions function is fired off despite the fact that options have not been requested. Traced the issue to componentWillReceiveProps(). When the props change on react-select, it should probably only fire asyncOptions if the autoload prop is true.
Opened a PR to address https://github.com/JedWatson/react-select/pull/477
Have the similar problem. I have a grid with lots of react-select components. And they all simultaneously call asyncOptions on grid rerender despite of autoload: false
Thanks @TigerC10 - reviewing #477 now, will merge as soon as a potential issue with it is resolved.
Version 1 of react-select is no longer supported.
In the best interest of the community we've decided to spend the time we have available on the latest version.
We apologise for any inconvenience.
Please see:
- v1 to v2 upgrade guide
- v1 documentation and examples