diff --git a/dist/index.js b/dist/index.js index c38f55e..ef7fe5e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -723,6 +723,11 @@ function (_React$Component) { labelClassName = "".concat(this.classes.search, " ").concat(_Bem.default.m(this.classes.search, 'placeholder')); } else { option = this.findByValue(this.state.defaultOptions, this.state.value); + + if (!option) { + option = this.state.defaultOptions[0]; + } + labelValue = option.name; labelClassName = this.classes.search; } diff --git a/package.json b/package.json index 61434bc..12e4ddd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-select-search", - "version": "0.9.2", + "version": "0.9.3", "description": "React powered selectbox with filter", "main": "dist/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index b7b093b..43ebc67 100644 --- a/src/index.js +++ b/src/index.js @@ -635,6 +635,11 @@ class SelectSearch extends React.Component { labelClassName = `${this.classes.search} ${Bem.m(this.classes.search, 'placeholder')}`; } else { option = this.findByValue(this.state.defaultOptions, this.state.value); + + if (!option) { + option = this.state.defaultOptions[0]; + } + labelValue = option.name; labelClassName = this.classes.search; }