When loading options async with Promises, like in the example [object Promise] string is set as input value of Select
const getOptions = (input) => {
return fetch(`/users/${input}.json`)
.then((response) => {
return response.json();
}).then((json) => {
return { options: json };
});
}
<Select.Async
loadOptions={getOptions}
/>
It is because of #907.
loadOptions from Async component attaches to onInputChange on Select component.
so this
if (this.state.inputValue !== event.target.value && this.props.onInputChange) {
let nextState = this.props.onInputChange(newInputValue);
if (nextState != null) {
newInputValue = '' + nextState;
}
}
sets newInputValue to return value of loadOptions, which is [object Promise]