Skip to content

Commit

Permalink
Value should be checked against props.valueKey, not the entire object…
Browse files Browse the repository at this point in the history
… structure
  • Loading branch information
Danny Herran committed Apr 18, 2016
1 parent 655b9ee commit 936da8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ const Select = React.createClass({
this.hasScrolledToOption = false;
if (this.props.multi) {
var valueArray = this.getValueArray();
if (valueArray.find(i => i === value)) {
if (valueArray.find(i => i[this.props.valueKey] === value[this.props.valueKey])) {
this.removeValue(value);
} else {
this.addValue(value);
Expand Down Expand Up @@ -516,7 +516,7 @@ const Select = React.createClass({

removeValue (value) {
var valueArray = this.getValueArray();
this.setValue(valueArray.filter(i => i !== value));
this.setValue(valueArray.filter(i => i[this.props.valueKey] !== value[this.props.valueKey]));
this.focus();
},

Expand Down

0 comments on commit 936da8a

Please sign in to comment.