Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 0 additions & 2 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7179,8 +7179,6 @@ const CONST = {
VIEW: {
TABLE: 'table',
BAR: 'bar',
LINE: 'line',
PIE: 'pie',
},
SYNTAX_FILTER_KEYS: {
TYPE: 'type',
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const SCREENS = {
ADVANCED_FILTERS_RHP: 'Search_Advanced_Filters_RHP',
ADVANCED_FILTERS_TYPE_RHP: 'Search_Advanced_Filters_Type_RHP',
ADVANCED_FILTERS_GROUP_BY_RHP: 'Search_Advanced_Filters_GroupBy_RHP',
ADVANCED_FILTERS_VIEW_RHP: 'Search_Advanced_Filters_View_RHP',
ADVANCED_FILTERS_STATUS_RHP: 'Search_Advanced_Filters_Status_RHP',
ADVANCED_FILTERS_DATE_RHP: 'Search_Advanced_Filters_Date_RHP',
ADVANCED_FILTERS_SUBMITTED_RHP: 'Search_Advanced_Filters_Submitted_RHP',
Expand Down
49 changes: 46 additions & 3 deletions src/components/Search/SearchPageHeader/SearchFiltersBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils';
import {getActiveAdminWorkspaces, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {isExpenseReport} from '@libs/ReportUtils';
import {buildQueryStringFromFilterFormValues, getQueryWithUpdatedValues, isFilterSupported, isSearchDatePreset} from '@libs/SearchQueryUtils';
import {getDatePresets, getFeedOptions, getGroupByOptions, getGroupCurrencyOptions, getHasOptions, getStatusOptions, getTypeOptions, getWithdrawalTypeOptions} from '@libs/SearchUIUtils';
import {
getDatePresets,
getFeedOptions,
getGroupByOptions,
getGroupCurrencyOptions,
getHasOptions,
getStatusOptions,
getTypeOptions,
getViewOptions,
getWithdrawalTypeOptions,
} from '@libs/SearchUIUtils';
import shouldAdjustScroll from '@libs/shouldAdjustScroll';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
Expand Down Expand Up @@ -88,8 +98,8 @@ function SearchFiltersBar({
const currentPolicy = usePolicy(currentSelectedPolicyID);
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: isUserValidatedSelector, canBeMissing: true});
const [searchAdvancedFiltersForm = getEmptyObject<Partial<SearchAdvancedFiltersForm>>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
// type, groupBy and status values are not guaranteed to respect the ts type as they come from user input
const {type: unsafeType, groupBy: unsafeGroupBy, status: unsafeStatus, flatFilters} = queryJSON;
// type, groupBy, status, and view values are not guaranteed to respect the ts type as they come from user input
const {type: unsafeType, groupBy: unsafeGroupBy, status: unsafeStatus, view: unsafeView, flatFilters} = queryJSON;
const [selectedIOUReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentSelectedReportID}`, {canBeMissing: true});
const isCurrentSelectedExpenseReport = isExpenseReport(currentSelectedReportID);
const theme = useTheme();
Expand Down Expand Up @@ -188,6 +198,12 @@ function SearchFiltersBar({
return [options, value];
}, [translate, unsafeGroupBy]);

const [viewOptions, viewValue] = useMemo(() => {
const options = getViewOptions(translate);
const value = options.find((option) => option.value === unsafeView) ?? options.at(0) ?? null;
return [options, value];
}, [translate, unsafeView]);

const [groupCurrencyOptions, groupCurrency] = useMemo(() => {
const options = getGroupCurrencyOptions(currencyList, getCurrencySymbol);
const value = options.find((option) => option.value === searchAdvancedFiltersForm.groupCurrency) ?? null;
Expand Down Expand Up @@ -373,6 +389,21 @@ function SearchFiltersBar({
[translate, groupByOptions, groupBy, updateFilterForm],
);

const viewComponent = useCallback(
({closeOverlay}: PopoverComponentProps) => {
return (
<SingleSelectPopup
label={translate('search.view.label')}
items={viewOptions}
value={viewValue}
closeOverlay={closeOverlay}
onChange={(item) => updateFilterForm({view: item?.value ?? CONST.SEARCH.VIEW.TABLE})}
/>
);
},
[translate, viewOptions, viewValue, updateFilterForm],
);

const groupCurrencyComponent = useCallback(
({closeOverlay}: PopoverComponentProps) => {
return (
Expand Down Expand Up @@ -666,6 +697,16 @@ function SearchFiltersBar({
},
]
: []),
...(shouldDisplayGroupByFilter
? [
{
label: translate('search.view.label'),
PopoverComponent: viewComponent,
value: viewValue?.text ?? null,
filterKey: FILTER_KEYS.VIEW,
},
]
: []),
].filter((filterItem) => isFilterSupported(filterItem.filterKey, type?.value ?? CONST.SEARCH.DATA_TYPES.EXPENSE));

return filterList;
Expand All @@ -674,6 +715,7 @@ function SearchFiltersBar({
type?.text,
groupBy?.value,
groupBy?.text,
viewValue?.text,
groupCurrency?.value,
withdrawalType?.text,
displayDate,
Expand All @@ -693,6 +735,7 @@ function SearchFiltersBar({
isComponent,
typeComponent,
groupByComponent,
viewComponent,
groupCurrencyComponent,
statusComponent,
datePickerComponent,
Expand Down
1 change: 1 addition & 0 deletions src/components/Search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ type SearchFilterKey =
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.TYPE
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.COLUMNS
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW;
Expand Down
5 changes: 5 additions & 0 deletions src/hooks/useAdvancedSearchFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const typeFiltersKeys = {
CONST.SEARCH.SYNTAX_FILTER_KEYS.STATUS,
CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID,
CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY,
CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW,
CONST.SEARCH.SYNTAX_FILTER_KEYS.GROUP_CURRENCY,
CONST.SEARCH.SYNTAX_FILTER_KEYS.HAS,
CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT,
Expand Down Expand Up @@ -253,6 +254,7 @@ function useAdvancedSearchFilters() {
const shouldDisplayTaxFilter = shouldDisplayFilter(Object.keys(taxRates).length, areTaxEnabled);
const shouldDisplayWorkspaceFilter = workspaces.some((section) => section.data.length > 1);
const shouldDisplayGroupCurrencyFilter = !!searchAdvancedFilters.groupBy;
const shouldDisplayViewFilter = !!searchAdvancedFilters.groupBy;
const shouldDisplayReportFieldFilter = Object.values(policies).some((policy): policy is NonNullable<Policy> => {
return Object.values(policy?.fieldList ?? {}).some((val) => val.type !== CONST.POLICY.DEFAULT_FIELD_LIST_TYPE);
});
Expand Down Expand Up @@ -287,6 +289,9 @@ function useAdvancedSearchFilters() {
if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.GROUP_CURRENCY && !shouldDisplayGroupCurrencyFilter) {
return;
}
if (key === CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW && !shouldDisplayViewFilter) {
return;
}
if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.ATTENDEE && !shouldDisplayAttendeeFilter) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7074,6 +7074,7 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
allMatchingItemsSelected: 'Alle passenden Elemente ausgewählt',
},
topSpenders: 'Top-Ausgaben',
view: {label: 'Ansehen', table: 'Tabelle', bar: 'Bar'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'Von',
[CONST.SEARCH.GROUP_BY.CARD]: 'Karten',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6960,6 +6960,11 @@ const translations = {
},
has: 'Has',
groupBy: 'Group by',
view: {
label: 'View',
table: 'Table',
bar: 'Bar',
},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'From',
[CONST.SEARCH.GROUP_BY.CARD]: 'Cards',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6623,6 +6623,7 @@ ${amount} para ${merchant} - ${date}`,
unapprovedCard: 'Tarjeta no aprobada',
reconciliation: 'Conciliación',
topSpenders: 'Mayores gastadores',
view: {label: 'Ver', table: 'Tabla', bar: 'Barra'},
saveSearch: 'Guardar búsqueda',
savedSearchesMenuItemTitle: 'Guardadas',
topCategories: 'Categorías principales',
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7086,6 +7086,7 @@ Exigez des informations de dépense comme les reçus et les descriptions, défin
allMatchingItemsSelected: 'Tous les éléments correspondants sont sélectionnés',
},
topSpenders: 'Plus gros dépensiers',
view: {label: 'Afficher', table: 'Tableau', bar: 'Barre'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'De',
[CONST.SEARCH.GROUP_BY.CARD]: 'Cartes',
Expand Down
1 change: 1 addition & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7063,6 +7063,7 @@ Richiedi dettagli di spesa come ricevute e descrizioni, imposta limiti e valori
allMatchingItemsSelected: 'Tutti gli elementi corrispondenti selezionati',
},
topSpenders: 'Maggiori spenditori',
view: {label: 'Visualizza', table: 'Tabella', bar: 'Bar'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'Da',
[CONST.SEARCH.GROUP_BY.CARD]: 'Carte',
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7002,6 +7002,7 @@ ${reportName}
allMatchingItemsSelected: '一致する項目をすべて選択済み',
},
topSpenders: 'トップ支出者',
view: {label: '表示', table: 'テーブル', bar: 'バー'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: '差出人',
[CONST.SEARCH.GROUP_BY.CARD]: 'カード',
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7046,6 +7046,7 @@ Vraag verplichte uitgavedetails zoals bonnetjes en beschrijvingen, stel limieten
allMatchingItemsSelected: 'Alle overeenkomende items geselecteerd',
},
topSpenders: 'Grootste uitgaven',
view: {label: 'Bekijken', table: 'Tabel', bar: 'Bar'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'Van',
[CONST.SEARCH.GROUP_BY.CARD]: 'Kaarten',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7034,6 +7034,7 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
allMatchingItemsSelected: 'Wybrano wszystkie pasujące elementy',
},
topSpenders: 'Najwięksi wydający',
view: {label: 'Zobacz', table: 'Tabela', bar: 'Pasek'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'Od',
[CONST.SEARCH.GROUP_BY.CARD]: 'Karty',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7035,6 +7035,7 @@ Exija detalhes de despesas como recibos e descrições, defina limites e padrõe
allMatchingItemsSelected: 'Todos os itens correspondentes selecionados',
},
topSpenders: 'Maiores gastadores',
view: {label: 'Ver', table: 'Tabela', bar: 'Bar'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: 'De',
[CONST.SEARCH.GROUP_BY.CARD]: 'Cartões',
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6882,6 +6882,7 @@ ${reportName}
allMatchingItemsSelected: '已选择所有匹配的项目',
},
topSpenders: '最高支出者',
view: {label: '查看', table: '表格', bar: '栏'},
chartTitles: {
[CONST.SEARCH.GROUP_BY.FROM]: '来自',
[CONST.SEARCH.GROUP_BY.CARD]: '卡片',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ const SearchAdvancedFiltersModalStackNavigator = createModalStackNavigator<Searc
[SCREENS.SEARCH.ADVANCED_FILTERS_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_TYPE_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersTypePage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_GROUP_BY_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersGroupByPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_VIEW_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersViewPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_STATUS_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersStatusPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_DATE_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersDatePage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_SUBMITTED_RHP]: () => require<ReactComponentModule>('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersSubmittedPage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const SEARCH_TO_RHP: Partial<Record<keyof SearchFullscreenNavigatorParamList, st
SCREENS.SEARCH.ROOT_VERIFY_ACCOUNT,
SCREENS.SEARCH.ADVANCED_FILTERS_TYPE_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_GROUP_BY_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_VIEW_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_STATUS_RHP,
SCREENS.SEARCH.REPORT_VERIFY_ACCOUNT,
SCREENS.SEARCH.TRANSACTION_HOLD_REASON_RHP,
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.SEARCH.ADVANCED_FILTERS_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(),
[SCREENS.SEARCH.ADVANCED_FILTERS_TYPE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.TYPE),
[SCREENS.SEARCH.ADVANCED_FILTERS_GROUP_BY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.GROUP_BY),
[SCREENS.SEARCH.ADVANCED_FILTERS_VIEW_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.VIEW),
[SCREENS.SEARCH.ADVANCED_FILTERS_STATUS_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.STATUS),
[SCREENS.SEARCH.ADVANCED_FILTERS_DATE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE),
[SCREENS.SEARCH.ADVANCED_FILTERS_SUBMITTED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED),
Expand Down
13 changes: 12 additions & 1 deletion src/libs/SearchQueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ function buildQueryStringFromFilterFormValues(filterValues: Partial<SearchAdvanc
}

// We separate type and status filters from other filters to maintain hashes consistency for saved searches
const {type, status, groupBy, columns, limit, ...otherFilters} = supportedFilterValues;
const {type, status, groupBy, view, columns, limit, ...otherFilters} = supportedFilterValues;
const filtersString: string[] = [];

filtersString.push(`${CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_BY}:${options?.sortBy ?? CONST.SEARCH.TABLE_COLUMNS.DATE}`);
Expand All @@ -615,6 +615,12 @@ function buildQueryStringFromFilterFormValues(filterValues: Partial<SearchAdvanc
filtersString.push(`${CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY}:${sanitizedGroupBy}`);
}

// View is only valid when groupBy is set
if (view && groupBy) {
const sanitizedView = sanitizeSearchValue(view);
filtersString.push(`${CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW}:${sanitizedView}`);
}

if (status && typeof status === 'string') {
const sanitizedStatus = sanitizeSearchValue(status);
filtersString.push(`${CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS}:${sanitizedStatus}`);
Expand Down Expand Up @@ -1012,6 +1018,11 @@ function buildFilterFormValuesFromQuery(

if (queryJSON.groupBy) {
filtersForm[FILTER_KEYS.GROUP_BY] = queryJSON.groupBy;

// View is only allowed when groupBy is set
if (queryJSON.view) {
filtersForm[FILTER_KEYS.VIEW] = queryJSON.view;
}
}

if (queryJSON.columns) {
Expand Down
6 changes: 6 additions & 0 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
SearchGroupBy,
SearchQueryJSON,
SearchStatus,
SearchView,
SearchWithdrawalType,
SelectedTransactionInfo,
SingularSearchStatus,
Expand Down Expand Up @@ -3749,6 +3750,10 @@ function getGroupByOptions(translate: LocalizedTranslate) {
return Object.values(CONST.SEARCH.GROUP_BY).map<SingleSelectItem<SearchGroupBy>>((value) => ({text: translate(`search.filters.groupBy.${value}`), value}));
}

function getViewOptions(translate: LocalizedTranslate) {
return Object.values(CONST.SEARCH.VIEW).map<SingleSelectItem<SearchView>>((value) => ({text: translate(`search.view.${value}`), value}));
}

function getGroupCurrencyOptions(currencyList: OnyxTypes.CurrencyList, getCurrencySymbol: CurrencyListContextProps['getCurrencySymbol']) {
return Object.keys(currencyList).reduce(
(options, currencyCode) => {
Expand Down Expand Up @@ -4499,6 +4504,7 @@ export {
getStatusOptions,
getTypeOptions,
getGroupByOptions,
getViewOptions,
getGroupCurrencyOptions,
getFeedOptions,
getWideAmountIndicators,
Expand Down
15 changes: 15 additions & 0 deletions src/pages/Search/AdvancedSearchFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ const baseFilterConfig = {
description: 'search.groupBy' as const,
route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.GROUP_BY),
},
view: {
getTitle: getFilterViewDisplayTitle,
description: 'search.view.label' as const,
route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.VIEW),
},
status: {
getTitle: getStatusFilterDisplayTitle,
description: 'common.status' as const,
Expand Down Expand Up @@ -490,6 +495,14 @@ function getFilterDisplayTitle(
return Array.isArray(filterValue) ? filterValue.join(', ') : filterValue;
}

function getFilterViewDisplayTitle(filters: Partial<SearchAdvancedFiltersForm>, translate: LocaleContextProps['translate']) {
const filterValue = filters[CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW];
if (!filterValue) {
return translate('search.view.table');
}
return translate(`search.view.${filterValue as ValueOf<typeof CONST.SEARCH.VIEW>}`);
}

function getStatusFilterDisplayTitle(filters: Partial<SearchAdvancedFiltersForm>, type: SearchDataTypes, translate: LocaleContextProps['translate']) {
const statusOptions = getStatusOptions(translate, type).concat({text: translate('common.all'), value: CONST.SEARCH.STATUS.EXPENSE.ALL});
let filterValue = filters?.status;
Expand Down Expand Up @@ -633,6 +646,8 @@ function AdvancedSearchFilters() {
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, workspacesData);
} else if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.STATUS) {
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, currentType, translate);
} else if (key === CONST.SEARCH.SYNTAX_ROOT_KEYS.VIEW) {
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, translate);
} else {
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, key, translate, localeCompare);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ function SearchFiltersGroupByPage() {
}, []);

const applyChanges = useCallback(() => {
updateAdvancedFilters({groupBy: selectedItem ?? null});
// When groupBy is cleared, also clear the view since view is only valid when groupBy is set
const updates = selectedItem ? {groupBy: selectedItem} : {groupBy: null, view: null};
updateAdvancedFilters(updates);
Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute());
}, [selectedItem]);

Expand Down
Loading
Loading