fix: fix search input when value is prepopulated

release
Nolan Lawson 2019-03-10 11:19:41 -07:00
parent 5ef7a2a7da
commit 978e7b68a1
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,13 @@ export default class Search extends React.PureComponent {
this.handleChange = throttleIdleTask(this.handleChange.bind(this))
}
componentDidMount() {
// in some cases (e.g. preact) the input may already be pre-populated
if (this.input.value) {
this.search(this.input.value)
}
}
search(value) {
if (value == '')
this.setState({