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],