From ebe53c83f90bb7e76aae29c811dfbe514b608f9d Mon Sep 17 00:00:00 2001 From: shakti97 Date: Mon, 6 Apr 2020 09:21:09 +0530 Subject: [PATCH] fix(trim query before search) --- client/modules/IDE/components/Searchbar/Searchbar.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/modules/IDE/components/Searchbar/Searchbar.jsx b/client/modules/IDE/components/Searchbar/Searchbar.jsx index 1577ec5e..b602d874 100644 --- a/client/modules/IDE/components/Searchbar/Searchbar.jsx +++ b/client/modules/IDE/components/Searchbar/Searchbar.jsx @@ -26,12 +26,13 @@ class Searchbar extends React.Component { handleSearchEnter = (e) => { if (e.key === 'Enter') { - this.props.setSearchTerm(this.state.searchValue); + this.searchChange(); } } - searchChange = (value) => { - this.props.setSearchTerm(this.state.searchValue); + searchChange = () => { + if (this.state.searchValue.trim().length === 0) return; + this.props.setSearchTerm(this.state.searchValue.trim()); }; handleSearchChange = (e) => {