diff --git a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx index 58d3a847d3efc..7539197e8462f 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx @@ -6,7 +6,7 @@ */ import { Search as LocalSearch, PrefixIndexStrategy } from 'js-search'; -import { useEffect, useRef } from 'react'; +import { useRef } from 'react'; import type { IntegrationCardItem } from '../../../../common/types/models'; @@ -16,13 +16,11 @@ export const fieldsToSearch = ['name', 'title']; export function useLocalSearch(packageList: IntegrationCardItem[]) { const localSearchRef = useRef(new LocalSearch(searchIdField)); - useEffect(() => { - const localSearch = new LocalSearch(searchIdField); - localSearch.indexStrategy = new PrefixIndexStrategy(); - fieldsToSearch.forEach((field) => localSearch.addIndex(field)); - localSearch.addDocuments(packageList); - localSearchRef.current = localSearch; - }, [packageList]); + const localSearch = new LocalSearch(searchIdField); + localSearch.indexStrategy = new PrefixIndexStrategy(); + fieldsToSearch.forEach((field) => localSearch.addIndex(field)); + localSearch.addDocuments(packageList); + localSearchRef.current = localSearch; return localSearchRef; }