After one selection is made, all subsequent options appear selected.
I am having an issue where the first selection I make yields normal options to select from that render properly:

Then, when I blur and type something again, I get:

Below is the component:
<AsyncSelect
isClearable
isDisabled={this.props.disabled}
inputValue={this.state.query}
autoBlur
blurInputOnSelect
placeholder={this.state.placeholder}
// Fire the api here and get results async
loadOptions={this.loadOptions}
//just updates the state
onInputChange={this.handleInputChange}
onChange={this.handleChange}
components={
{
DropdownIndicator: () => null,
IndicatorSeparator: () => null,
NoOptionsMessage: () => <div>Start typing a destination</div>
}
}
/>
Expected behavior: The component is styled in the same way before and after I select+blur it.
I am hoping there is some prop that I can tweak to prevent this behavior?
I'm having a similar issue. In my case, loadOptions doesn't return an array of plain strings but an array of objects (ex: [{country: "xyz", city: "abc"}, ....])
I managed to fix this by providing an isOptionSelected prop.
https://github.com/JedWatson/react-select/blob/master/packages/react-select/src/Select.js#L1286
Hope it helps!
@claytongroth What is the value of the value attribute of your options? All options being selected would mean they all share the same value.
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.
If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.
However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!
I have the same issue, solved it using the below approach. Select "options" should contain the key "value". Example: const countries =[ { code: 'AD', label: 'Andorra', phone: '376' ,value:'' }, { code: 'AE', label: 'United Arab Emirates', phone: '971', value:'' } { code: 'IN', label: 'India', phone: '91', value:'' } ]
If you remove the "value" from above list item then we are experiencing this problem. Hope this helps..!!