From 1091a4e4af0731769e9768fb0137feb6f7cb66e9 Mon Sep 17 00:00:00 2001 From: Sundeep Chand Date: Tue, 28 Jul 2020 12:48:52 +0530 Subject: [PATCH] Update searchbar to query with empty term --- .../IDE/components/Searchbar/Searchbar.jsx | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/client/modules/IDE/components/Searchbar/Searchbar.jsx b/client/modules/IDE/components/Searchbar/Searchbar.jsx index cd9693bd..3b9c92c0 100644 --- a/client/modules/IDE/components/Searchbar/Searchbar.jsx +++ b/client/modules/IDE/components/Searchbar/Searchbar.jsx @@ -23,25 +23,19 @@ class Searchbar extends React.Component { }); } - handleSearchEnter = (e) => { - if (e.key === 'Enter') { - this.searchChange(); - } - } + // handleSearchEnter = (e) => { + // if (e.key === 'Enter') { + // this.searchChange(); + // } + // } searchChange = () => { - if (this.state.searchValue.trim().length === 0) return; this.props.setSearchTerm(this.state.searchValue.trim()); }; 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.throttledSearchChange(this.state.searchValue); + this.throttledSearchChange(this.state.searchValue.trim()); }); } @@ -58,7 +52,7 @@ class Searchbar extends React.Component { value={searchValue} placeholder={this.props.searchLabel} onChange={this.handleSearchChange} - onKeyUp={this.handleSearchEnter} + // onKeyUp={this.handleSearchEnter} />