Merge pull request #290 from nolanlawson/nolan/fix-prepopulated-search

fix: fix search input when value is prepopulated
nolan/hinaloe-test
Nolan Lawson 2019-03-12 08:22:27 -07:00 committed by GitHub
commit 7e207ba851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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({