Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tbleckert committed May 30, 2018
1 parent 232cf11 commit dfebca3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,17 @@ function (_React$Component) {
_value = props.value,
multiple = props.multiple;
var stateValue = !_value && multiple ? [] : _value;
var flattenedOptions = (0, _FlattenOptions.default)(_options);
var _search = '';

if (stateValue) {
var option = _this.findByValue(_options, stateValue);
var option = _this.findByValue(flattenedOptions, stateValue);

if (option) {
_search = option.name;
}
}

var flattenedOptions = (0, _FlattenOptions.default)(_options);
_this.state = {
search: _search,
value: stateValue,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-select-search",
"version": "0.9.1",
"version": "0.9.2",
"description": "React powered selectbox with filter",
"main": "dist/index.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,18 @@ class SelectSearch extends React.Component {

const { options, value, multiple } = props;
const stateValue = (!value && multiple) ? [] : value;
const flattenedOptions = FlattenOptions(options);

let search = '';

if (stateValue) {
const option = this.findByValue(options, stateValue);
const option = this.findByValue(flattenedOptions, stateValue);

if (option) {
search = option.name;
}
}

const flattenedOptions = FlattenOptions(options);

this.state = {
search,
value: stateValue,
Expand Down

0 comments on commit dfebca3

Please sign in to comment.