Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ function SearchFiltersCategoryPage() {
const items = [{name: translate('search.noCategory'), value: CONST.SEARCH.CATEGORY_EMPTY_VALUE as string}];
const uniqueCategoryNames = new Set<string>();

if (!selectedPoliciesCategories || selectedPoliciesCategories.length === 0) {
if (policyIDs.length === 0) {
const categories = Object.values(allPolicyCategories ?? {}).flatMap((policyCategories) => Object.values(policyCategories ?? {}));
for (const category of categories) {
uniqueCategoryNames.add(category.name);
}
} else {
} else if (selectedPoliciesCategories.length > 0) {
for (const category of selectedPoliciesCategories) {
uniqueCategoryNames.add(category.name);
}
Expand All @@ -80,7 +80,7 @@ function SearchFiltersCategoryPage() {
}),
);
return items;
}, [allPolicyCategories, selectedPoliciesCategories, translate]);
}, [allPolicyCategories, policyIDs.length, selectedPoliciesCategories, translate]);

const onSaveSelection = useCallback((values: string[]) => updateAdvancedFilters({category: values}), []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ function SearchFiltersTagPage() {
const items = [{name: translate('search.noTag'), value: CONST.SEARCH.TAG_EMPTY_VALUE as string}];
const uniqueTagNames = new Set<string>();

if (!selectedPoliciesTagLists || selectedPoliciesTagLists.length === 0) {
if (policyIDs.length === 0) {
const tagListsUnpacked = Object.values(allPolicyTagLists ?? {}).filter((item) => !!item);
for (const tag of tagListsUnpacked.map(getTagNamesFromTagsLists).flat()) {
uniqueTagNames.add(tag);
}
} else {
} else if (selectedPoliciesTagLists.length > 0) {
for (const tag of selectedPoliciesTagLists) {
uniqueTagNames.add(tag);
}
}
items.push(...Array.from(uniqueTagNames).map((tagName) => ({name: getCleanedTagName(tagName), value: tagName})));

return items;
}, [allPolicyTagLists, selectedPoliciesTagLists, translate]);
}, [allPolicyTagLists, policyIDs.length, selectedPoliciesTagLists, translate]);

const updateTagFilter = useCallback((values: string[]) => updateAdvancedFilters({tag: values}), []);

Expand Down
Loading