Skip to content

Commit

Permalink
Simplify _cacheTreeNodesStates assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Jan 5, 2017
1 parent 0e35943 commit 9cab83b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,11 @@ const Select = React.createClass({
componentWillReceiveProps(nextProps) {
// save parsed treeData, for performance (treeData may be very big)
this.renderedTreeData = this.renderTreeData(nextProps);
if (this._cacheTreeNodesStates !== 'no' &&
this._savedValue && nextProps.value === this._savedValue) {
// Detecting whether the object of `onChange`'s argument is old ref.
// Better to do a deep equal later.
this._cacheTreeNodesStates = true;
} else {
this._cacheTreeNodesStates = false;
}
// Detecting whether the object of `onChange`'s argument is old ref.
// Better to do a deep equal later.
this._cacheTreeNodesStates = this._cacheTreeNodesStates !== 'no' &&
this._savedValue &&
nextProps.value === this._savedValue;
if (this.props.treeData !== nextProps.treeData ||
this.props.children !== nextProps.children) {
// refresh this._treeNodesStates cache
Expand Down

0 comments on commit 9cab83b

Please sign in to comment.