From 2048814b91a97e74642517c3bce43e28e8191589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Fri, 20 Sep 2024 15:23:05 +0200 Subject: [PATCH] fix revert --- hooks/use-filtered-list/index.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/hooks/use-filtered-list/index.ts b/hooks/use-filtered-list/index.ts index 695cbd30..fa6a9877 100644 --- a/hooks/use-filtered-list/index.ts +++ b/hooks/use-filtered-list/index.ts @@ -23,16 +23,8 @@ export function useFilteredList( const filterList = useCallback( (searchTerm: string) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [matchedIds, _idInfos, order] = fuzzy.search(propertyList, searchTerm); - - if (!matchedIds || !order) { - return []; - } - - // sort the matchedIds based on the order - const sortedItems = order.map((index) => matchedIds[index]); - const results = sortedItems.map((index) => list[index]); + const matchedNames = fuzzy.filter(propertyList, searchTerm); + const results = matchedNames?.map((index) => list[index]) || []; return results; }, [propertyList, list],