From 35b3c5b9653a4834eb240dd78700cd2f45e91cd0 Mon Sep 17 00:00:00 2001 From: Xc165543337 <90028194+Xc165543337@users.noreply.github.com> Date: Wed, 22 May 2024 19:18:54 +0200 Subject: [PATCH] fix: duplicated icons in list --- .../components/HabitForm/IconSelectorModal.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/presentation/react-native/components/HabitForm/IconSelectorModal.tsx b/presentation/react-native/components/HabitForm/IconSelectorModal.tsx index 938a4c7..e28d2a6 100644 --- a/presentation/react-native/components/HabitForm/IconSelectorModal.tsx +++ b/presentation/react-native/components/HabitForm/IconSelectorModal.tsx @@ -39,12 +39,11 @@ const fuseOptions = { const fuse = new Fuse(iconNames, fuseOptions) const findIconsInLibrary = (icon: string): string[] => { - return fuse - .search(icon) - .map((result) => { - return result.item - }) - .slice(0, 50) + const results = fuse.search(icon).map((result) => { + return result.item + }) + const uniqueResults = Array.from(new Set(results)) + return uniqueResults.slice(0, 50) } export const IconSelectorModal: React.FC = ({