Skip to content

Commit

Permalink
fix(autoload): call this.autoloadAsyncOptions() into `componentDidM…
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4x committed Jun 29, 2015
1 parent bbefe62 commit f1a558d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ var Select = React.createClass({
}
};

this.setState(this.getStateFromValue(this.props.value), function () {
//Executes after state change is done. Fixes issue #201
if (this.props.asyncOptions && this.props.autoload) {
this.autoloadAsyncOptions();
}
});
this.setState(this.getStateFromValue(this.props.value));
},

componentWillUnmount: function componentWillUnmount() {
Expand All @@ -150,6 +145,12 @@ var Select = React.createClass({
}
},

componentDidMount: function componentdDidMount() {
if (this.props.asyncOptions && this.props.autoload) {
this.autoloadAsyncOptions();
}
},

componentWillReceiveProps: function componentWillReceiveProps(newProps) {
if (JSON.stringify(newProps.options) !== JSON.stringify(this.props.options)) {
this.setState({
Expand Down Expand Up @@ -814,4 +815,4 @@ var Select = React.createClass({

});

module.exports = Select;
module.exports = Select;

0 comments on commit f1a558d

Please sign in to comment.