When clearing all inputs from the select box I get this error.
Assuming that the this is due to the multi select logic and the allowed value for the value inside the Value component is object and array is passed.
I got the same error using the latest (master) and trying to use the Gravatar example. I set the value to null in the function setValue. It clears out the values without throwing errors.
import _ from 'lodash';
import Select from 'react-select';
...
var MyDropdown = React.createClass({
......
setValue (value) {
if(_.isEmpty(value))
this.setState({value: null});
else
this.setState({ value });
},
render() {
< Select
onChange={this.setValue}
optionComponent={GravatarOption}
options={USERS}
value={this.state.value}
valueComponent={GravatarValue} />
}
});
It is apparently happening only once. So to be more detailed:
And then, as @andreijs mentioned, instead of receiving an Object in the onChange callback, we get an Array:
<Select.Async
// "option" should be an object
onChange={(option) => this.setState({selected: option})}
... />
@eliseumds @andreijs FYI, I think this will be resolved by https://github.com/JedWatson/react-select/pull/773.
I notice the same problem today, as I was setting the state using:
this.state = {
disabled: false,
options: props.options,
value: []
};
I changed to:
this.state = {
disabled: false,
options: props.options,
value: null
};
And that solved the react warning problem.
HTH
The PR is still not merged, issue is still happening. :-(
The issue still exists, please let it merge asap!!
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.
If you feel this issue / pull request 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.