Skip to content

Commit

Permalink
fix-resource-manager-whitescreen (#1193)
Browse files Browse the repository at this point in the history
* fixed minisearch duplicate values

* formatting
  • Loading branch information
plehocky authored Mar 20, 2023
1 parent 69d43e7 commit 9f6b443
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/shared/src/hooks/use-minisearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ const useMinisearch = <T>({
return [];
}, 80)();

useEffect(() => minisearch.addAll(items || []), [items]); // eslint-disable-line react-hooks/exhaustive-deps
useEffect(() => {
minisearch.removeAll();
minisearch.addAll(items || []);
}, [items]); // eslint-disable-line react-hooks/exhaustive-deps

const results = searchText.length > 0 ? searchFn() : items;

return {
results: results || [],
searchText,
Expand Down

0 comments on commit 9f6b443

Please sign in to comment.