fixed search result reset issue

This commit is contained in:
Sundeep Chand 2020-07-27 23:47:51 +05:30 committed by Cassie Tarakajian
parent cb3c82475b
commit dab1e5334e

View file

@ -35,6 +35,11 @@ class Searchbar extends React.Component {
}; };
handleSearchChange = (e) => { handleSearchChange = (e) => {
if (e.target.value === '') {
// Manually reset the searchValue if the search field becomes empty.
this.handleResetSearch();
return;
}
this.setState({ searchValue: e.target.value }, () => { this.setState({ searchValue: e.target.value }, () => {
this.throttledSearchChange(this.state.searchValue); this.throttledSearchChange(this.state.searchValue);
}); });