Skip to content
Closed
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
3 changes: 2 additions & 1 deletion src/libs/SearchAutocompleteUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ function filterOutRangesWithCorrectValue(
case CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION:
return actionList.includes(range.value);
case CONST.SEARCH.SYNTAX_FILTER_KEYS.CATEGORY:
return categoryList.get().includes(range.value);
// Treat the empty category as selected if any of its synonyms (e.g., "none", "uncategorized") appear in filterValues.
return categoryList.get().includes(range.value) || CONST.SEARCH.CATEGORY_EMPTY_VALUE.split(',').some((emptyVal) => emptyVal.toLowerCase() === range.value.toLowerCase());
case CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG:
return tagList.get().includes(range.value);
case CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY:
Expand Down
5 changes: 3 additions & 2 deletions src/libs/SearchQueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,9 @@ function buildFilterFormValuesFromQuery(
.flat();
const uniqueCategories = new Set(categories);
const emptyCategories = CONST.SEARCH.CATEGORY_EMPTY_VALUE.split(',');
const hasEmptyCategoriesInFilter = emptyCategories.every((category) => filterValues.includes(category));
// We split CATEGORY_EMPTY_VALUE into individual values to detect both are present in filterValues.
// Return true if the value is a known category or one of the empty-category synonyms (e.g., 'none', 'uncategorized').
const filterValuesLower = new Set(filterValues.map((v) => v.toLowerCase()));
const hasEmptyCategoriesInFilter = emptyCategories.some((category) => filterValuesLower.has(category.toLowerCase()));
// If empty categories are found, append the CATEGORY_EMPTY_VALUE to filtersForm.
filtersForm[key as typeof filterKey] = filterValues.filter((name) => uniqueCategories.has(name)).concat(hasEmptyCategoriesInFilter ? [CONST.SEARCH.CATEGORY_EMPTY_VALUE] : []);
}
Expand Down
Loading