From 9f6b44365ef2b2624a5e4755d298fa50cfbebd37 Mon Sep 17 00:00:00 2001 From: plehocky <117287338+plehocky@users.noreply.github.com> Date: Mon, 20 Mar 2023 15:59:14 +0100 Subject: [PATCH] fix-resource-manager-whitescreen (#1193) * fixed minisearch duplicate values * formatting --- packages/shared/src/hooks/use-minisearch.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/hooks/use-minisearch.ts b/packages/shared/src/hooks/use-minisearch.ts index f790224d9..b1defe496 100644 --- a/packages/shared/src/hooks/use-minisearch.ts +++ b/packages/shared/src/hooks/use-minisearch.ts @@ -36,10 +36,12 @@ const useMinisearch = ({ 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,