Skip to content
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

Is there a way to set the inputValue via props when using asyncOptions #392

Closed
sambomartin opened this issue Aug 20, 2015 · 4 comments
Closed

Comments

@sambomartin
Copy link

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

@TigerC10
Copy link

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 #477

@oluckyman
Copy link

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

@JedWatson
Copy link
Owner

Thanks @TigerC10 - reviewing #477 now, will merge as soon as a potential issue with it is resolved.

@jossmac
Copy link
Collaborator

jossmac commented Mar 17, 2020

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:

  1. v1 to v2 upgrade guide
  2. v1 documentation and examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants