Skip to content

Commit

Permalink
fix revert
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy committed Sep 20, 2024
1 parent 4b2de20 commit 2048814
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions hooks/use-filtered-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,8 @@ export function useFilteredList<TListItem extends { [key: string]: string }>(

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

0 comments on commit 2048814

Please sign in to comment.