Skip to content

Commit

Permalink
Fix async loadOptions bug.
Browse files Browse the repository at this point in the history
We should not return a promise here. The retured value will be used at handleInputChange() of Select.js.
And this value will be used to setState as 'inputValue' which will become '[object Promise]'.
  • Loading branch information
chenzhihao committed Jun 30, 2016
1 parent 01de8d3 commit 0314561
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ const Select = React.createClass({
if (this.state.inputValue !== event.target.value && this.props.onInputChange) {
let nextState = this.props.onInputChange(newInputValue);
// Note: != used deliberately here to catch undefined and null
if (nextState != null && typeof nextState !== 'object') {
if (nextState != null && typeof nextState !== 'object' && typeof nextState.then === 'undefined') {
newInputValue = '' + nextState;
}
}
Expand Down

0 comments on commit 0314561

Please sign in to comment.