Merge pull request #1365 from shakti97/trim-query

fix(trim query before search)
This commit is contained in:
Cassie Tarakajian 2020-04-14 19:01:19 -04:00 committed by GitHub
commit 5b63410812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,12 +26,13 @@ class Searchbar extends React.Component {
handleSearchEnter = (e) => { handleSearchEnter = (e) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
this.props.setSearchTerm(this.state.searchValue); this.searchChange();
} }
} }
searchChange = (value) => { searchChange = () => {
this.props.setSearchTerm(this.state.searchValue); if (this.state.searchValue.trim().length === 0) return;
this.props.setSearchTerm(this.state.searchValue.trim());
}; };
handleSearchChange = (e) => { handleSearchChange = (e) => {