Skip to content

Commit

Permalink
Merge pull request Expensify#48074 from software-mansion-labs/289Adam…
Browse files Browse the repository at this point in the history
…289/48005-fix-tag-filter-duplicates

fix tag filter duplicates
  • Loading branch information
luacmartins authored Aug 27, 2024
2 parents b217d11 + 4fe0d07 commit 2a04fe1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ function SearchFiltersTagPage() {

const tagItems = useMemo(() => {
if (!singlePolicyTagsList) {
const uniqueTagNames = new Set<string>();
const tagListsUnpacked = Object.values(allPoliciesTagsLists ?? {}).filter((item) => !!item) as PolicyTagLists[];
return tagListsUnpacked
tagListsUnpacked
.map((policyTagLists) => {
return getTagNamesFromTagsLists(policyTagLists).map((name) => ({name, value: name}));
return getTagNamesFromTagsLists(policyTagLists);
})
.flat();
.flat()
.forEach((tag) => uniqueTagNames.add(tag));
return Array.from(uniqueTagNames).map((tagName) => ({name: tagName, value: tagName}));
}
return getTagNamesFromTagsLists(singlePolicyTagsList).map((name) => ({name, value: name}));
}, [allPoliciesTagsLists, singlePolicyTagsList]);
Expand Down

0 comments on commit 2a04fe1

Please sign in to comment.