Skip to content

Commit

Permalink
fix: remove intial open on search undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 27, 2021
1 parent 2f11249 commit d9a06e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/components/src/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ export const SearchInput = <ItemType extends SearchInputItemType>({
setIsOpen(newIsOpen && items.length > 0);
}
};
const hasSearch = !!search;
useEffect(() => {
setIsOpen(items.length > 0 && search !== '');
}, [items, search]);
setIsOpen(items.length > 0 && hasSearch);
}, [items, hasSearch]);

const updateSearch = async (newSearch: string) => {
await onSearch(newSearch);
Expand Down

0 comments on commit d9a06e7

Please sign in to comment.