From 49b3ce42050d0bd5f65120d3ae2df50bc516beaf Mon Sep 17 00:00:00 2001 From: enes <enes@nostrdev.com> Date: Thu, 12 Dec 2024 17:19:58 +0100 Subject: [PATCH] fix(category): top level category bug --- .../Filters/CategoryFilterPopup.tsx | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/components/Filters/CategoryFilterPopup.tsx b/src/components/Filters/CategoryFilterPopup.tsx index d118991..d4abdfe 100644 --- a/src/components/Filters/CategoryFilterPopup.tsx +++ b/src/components/Filters/CategoryFilterPopup.tsx @@ -252,18 +252,24 @@ export const CategoryFilterPopup = ({ </div> )} </div> - {(categoriesData as Category[]).map((category, i) => ( - <CategoryCheckbox - key={`${category.name}_${i}`} - inputValue={inputValue} - category={category} - path={[category.name]} - handleSingleSelection={handleSingleSelection} - handleCombinationSelection={handleCombinationSelection} - selectedSingles={filterCategories} - selectedCombinations={filterHierarchies} - /> - ))} + {(categoriesData as Category[]).map((category) => { + const name = + typeof category === 'string' ? category : category.name + return ( + <CategoryCheckbox + key={name} + inputValue={inputValue} + category={category} + path={[name]} + handleSingleSelection={handleSingleSelection} + handleCombinationSelection={ + handleCombinationSelection + } + selectedSingles={filterCategories} + selectedCombinations={filterHierarchies} + /> + ) + })} </div> </div> <div