From b5c87647cdd6a563a232a68826bb4ee543063335 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Wed, 4 Sep 2024 12:39:24 +0200 Subject: [PATCH 1/7] remove IDs from header --- src/components/Search/SearchPageHeader.tsx | 8 +++- src/libs/SearchUtils.ts | 53 +++++++++++++++++++--- src/pages/Search/SearchTypeMenu.tsx | 10 +++- 3 files changed, 63 insertions(+), 8 deletions(-) diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index c28eed688aaa..74390f3c6254 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -10,6 +10,7 @@ import type HeaderWithBackButtonProps from '@components/HeaderWithBackButton/typ import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; +import {usePersonalDetails} from '@components/OnyxProvider'; import type {ReportListItemType, TransactionListItemType} from '@components/SelectionList/types'; import Text from '@components/Text'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; @@ -21,6 +22,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as SearchActions from '@libs/actions/Search'; import Navigation from '@libs/Navigation/Navigation'; +import {getAllTaxRates} from '@libs/PolicyUtils'; import * as SearchUtils from '@libs/SearchUtils'; import SearchSelectedNarrow from '@pages/Search/SearchSelectedNarrow'; import variables from '@styles/variables'; @@ -127,6 +129,10 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa const {isSmallScreenWidth} = useResponsiveLayout(); const {selectedTransactions, clearSelectedTransactions} = useSearchContext(); const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE); + const personalDetails = usePersonalDetails(); + const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); + const taxRates = getAllTaxRates(); + const [cardList = {}] = useOnyx(ONYXKEYS.CARD_LIST); const selectedTransactionsKeys = Object.keys(selectedTransactions ?? {}); @@ -143,7 +149,7 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa [data, selectedTransactions], ); const {status, type} = queryJSON; - const headerSubtitle = isCustomQuery ? SearchUtils.getSearchHeaderTitle(queryJSON) : translate(getHeaderContent(type).titleText); + const headerSubtitle = isCustomQuery ? SearchUtils.getSearchHeaderTitle(queryJSON, personalDetails, cardList, reports, taxRates) : translate(getHeaderContent(type).titleText); const headerTitle = isCustomQuery ? translate('search.filtersHeader') : ''; const headerIcon = isCustomQuery ? Illustrations.Filters : getHeaderContent(type).icon; diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index b30ff55ef5ae..2d77a0ac1ead 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -1,3 +1,4 @@ +import type {OnyxCollection} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import type {ASTNode, QueryFilter, QueryFilters, SearchColumnType, SearchQueryJSON, SearchQueryString, SearchStatus, SortOrder} from '@components/Search/types'; import ReportListItem from '@components/SelectionList/Search/ReportListItem'; @@ -17,6 +18,8 @@ import DateUtils from './DateUtils'; import {translateLocal} from './Localize'; import navigationRef from './Navigation/navigationRef'; import type {AuthScreensParamList, BottomTabNavigatorParamList, RootStackParamList, State} from './Navigation/types'; +import * as PersonalDetailsUtils from './PersonalDetailsUtils'; +import * as ReportUtils from './ReportUtils'; import * as searchParser from './SearchParser/searchParser'; import * as TransactionUtils from './TransactionUtils'; import * as UserUtils from './UserUtils'; @@ -549,6 +552,36 @@ function getPolicyIDFromSearchQuery(queryJSON: SearchQueryJSON) { return policyID; } +function getDisplayValue( + filterName: string, + filter: string, + personalDetails: OnyxTypes.PersonalDetailsList, + cardList: OnyxTypes.CardList, + reports: OnyxCollection, + taxRates: Record, +) { + if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TO) { + return PersonalDetailsUtils.createDisplayName(personalDetails[filter]?.login ?? '', personalDetails[filter]); + } + if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID) { + return cardList[filter].bank; + } + if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.IN) { + return ReportUtils.getReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${filter}`]); + } + if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE) { + const result: string[] = []; + Object.entries(taxRates).forEach(([taxRateName, taxRateKeys]) => { + if (!taxRateKeys.some((taxRateKey) => taxRateKey === filter) || result.includes(taxRateName)) { + return; + } + result.push(taxRateName); + }); + return result.join(' '); + } + return filter; +} + function buildFilterString(filterName: string, queryFilters: QueryFilter[]) { let filterValueString = ''; queryFilters.forEach((queryFilter, index) => { @@ -556,22 +589,30 @@ function buildFilterString(filterName: string, queryFilters: QueryFilter[]) { if ((queryFilter.operator === 'eq' && queryFilters[index - 1]?.operator === 'eq') || (queryFilter.operator === 'neq' && queryFilters[index - 1]?.operator === 'neq')) { filterValueString += ` ${sanitizeString(queryFilter.value.toString())}`; } else { - filterValueString += ` ${filterName}${operatorToSignMap[queryFilter.operator]}${queryFilter.value}`; + filterValueString += ` ${filterName}${operatorToSignMap[queryFilter.operator]}${sanitizeString(queryFilter.value.toString())}`; } }); return filterValueString; } -function getSearchHeaderTitle(queryJSON: SearchQueryJSON) { - const {type, status} = queryJSON; +function getSearchHeaderTitle( + queryJSON: SearchQueryJSON, + PersonalDetails: OnyxTypes.PersonalDetailsList, + cardList: OnyxTypes.CardList, + reports: OnyxCollection, + TaxRates: Record, +) { const filters = getFilters(queryJSON) ?? {}; - - let title = `type:${type} status:${status}`; + let title = ''; Object.keys(filters).forEach((key) => { const queryFilter = filters[key as ValueOf] ?? []; - title += buildFilterString(key, queryFilter); + const displayQueryFilters: QueryFilter[] = queryFilter.map((filter) => ({ + operator: filter.operator, + value: getDisplayValue(key, filter.value.toString(), PersonalDetails, cardList, reports, TaxRates), + })); + title += buildFilterString(key, displayQueryFilters); }); return title; diff --git a/src/pages/Search/SearchTypeMenu.tsx b/src/pages/Search/SearchTypeMenu.tsx index c434bf346592..82c84bc85dd9 100644 --- a/src/pages/Search/SearchTypeMenu.tsx +++ b/src/pages/Search/SearchTypeMenu.tsx @@ -1,16 +1,20 @@ import React from 'react'; import {View} from 'react-native'; +import {useOnyx} from 'react-native-onyx'; import MenuItem from '@components/MenuItem'; +import {usePersonalDetails} from '@components/OnyxProvider'; import type {SearchQueryJSON} from '@components/Search/types'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useSingleExecution from '@hooks/useSingleExecution'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import {getAllTaxRates} from '@libs/PolicyUtils'; import * as SearchUtils from '@libs/SearchUtils'; import variables from '@styles/variables'; import * as Expensicons from '@src/components/Icon/Expensicons'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import type {SearchDataTypes} from '@src/types/onyx/SearchResults'; @@ -35,6 +39,10 @@ function SearchTypeMenu({queryJSON, isCustomQuery}: SearchTypeMenuProps) { const {shouldUseNarrowLayout} = useResponsiveLayout(); const {singleExecution} = useSingleExecution(); const {translate} = useLocalize(); + const personalDetails = usePersonalDetails(); + const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); + const taxRates = getAllTaxRates(); + const [cardList = {}] = useOnyx(ONYXKEYS.CARD_LIST); const typeMenuItems: SearchTypeMenuItem[] = [ { @@ -59,7 +67,7 @@ function SearchTypeMenu({queryJSON, isCustomQuery}: SearchTypeMenuProps) { const activeItemIndex = isCustomQuery ? -1 : typeMenuItems.findIndex((item) => item.type === type); if (shouldUseNarrowLayout) { - const title = isCustomQuery ? SearchUtils.getSearchHeaderTitle(queryJSON) : undefined; + const title = isCustomQuery ? SearchUtils.getSearchHeaderTitle(queryJSON, personalDetails, cardList, reports, taxRates) : undefined; return ( Date: Thu, 5 Sep 2024 13:11:13 +0200 Subject: [PATCH 2/7] fix empty results after changin order --- src/libs/SearchUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 21a2b8d70ecc..4b26e96b90e7 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -575,12 +575,12 @@ function getDisplayValue( return filter; } -function buildFilterString(filterName: string, queryFilters: QueryFilter[]) { +function buildFilterString(filterName: string, queryFilters: QueryFilter[], delimiter = ',') { let filterValueString = ''; queryFilters.forEach((queryFilter, index) => { // If the previous queryFilter has the same operator (this rule applies only to eq and neq operators) then append the current value if ((queryFilter.operator === 'eq' && queryFilters[index - 1]?.operator === 'eq') || (queryFilter.operator === 'neq' && queryFilters[index - 1]?.operator === 'neq')) { - filterValueString += ` ${sanitizeString(queryFilter.value.toString())}`; + filterValueString += `${delimiter}${sanitizeString(queryFilter.value.toString())}`; } else { filterValueString += ` ${filterName}${operatorToSignMap[queryFilter.operator]}${sanitizeString(queryFilter.value.toString())}`; } @@ -605,7 +605,7 @@ function getSearchHeaderTitle( operator: filter.operator, value: getDisplayValue(key, filter.value.toString(), PersonalDetails, cardList, reports, TaxRates), })); - title += buildFilterString(key, displayQueryFilters); + title += buildFilterString(key, displayQueryFilters, ' '); }); return title; From 2eccebcf178a09a2849a0e64151380cbdf742073 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Thu, 5 Sep 2024 14:10:56 +0200 Subject: [PATCH 3/7] review --- src/libs/SearchUtils.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 4b26e96b90e7..d0d39e969258 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -563,14 +563,10 @@ function getDisplayValue( return ReportUtils.getReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${filter}`]); } if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE) { - const result: string[] = []; - Object.entries(taxRates).forEach(([taxRateName, taxRateKeys]) => { - if (!taxRateKeys.some((taxRateKey) => taxRateKey === filter) || result.includes(taxRateName)) { - return; - } - result.push(taxRateName); - }); - return result.join(' '); + const result = Object.entries(taxRates) + .filter(([, taxRateKeys]) => taxRateKeys.includes(filter)) + .map(([taxRate]) => taxRate); + return [...new Set(result)].map((taxRate) => sanitizeString(taxRate)).join(' '); } return filter; } From 16af1a1d2d5b7918d087276fc142593575ab48f4 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Fri, 6 Sep 2024 11:31:21 +0200 Subject: [PATCH 4/7] fix tax rate display --- src/libs/SearchUtils.ts | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index d0d39e969258..6c956b89f916 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -545,14 +545,7 @@ function getPolicyIDFromSearchQuery(queryJSON: SearchQueryJSON) { return policyID; } -function getDisplayValue( - filterName: string, - filter: string, - personalDetails: OnyxTypes.PersonalDetailsList, - cardList: OnyxTypes.CardList, - reports: OnyxCollection, - taxRates: Record, -) { +function getDisplayValue(filterName: string, filter: string, personalDetails: OnyxTypes.PersonalDetailsList, cardList: OnyxTypes.CardList, reports: OnyxCollection) { if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM || filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TO) { return PersonalDetailsUtils.createDisplayName(personalDetails[filter]?.login ?? '', personalDetails[filter]); } @@ -562,12 +555,6 @@ function getDisplayValue( if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.IN) { return ReportUtils.getReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${filter}`]); } - if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE) { - const result = Object.entries(taxRates) - .filter(([, taxRateKeys]) => taxRateKeys.includes(filter)) - .map(([taxRate]) => taxRate); - return [...new Set(result)].map((taxRate) => sanitizeString(taxRate)).join(' '); - } return filter; } @@ -597,10 +584,22 @@ function getSearchHeaderTitle( Object.keys(filters).forEach((key) => { const queryFilter = filters[key as ValueOf] ?? []; - const displayQueryFilters: QueryFilter[] = queryFilter.map((filter) => ({ - operator: filter.operator, - value: getDisplayValue(key, filter.value.toString(), PersonalDetails, cardList, reports, TaxRates), - })); + let displayQueryFilters: QueryFilter[] = []; + if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE) { + const taxRateIDs = queryFilter.map((filter) => filter.value.toString()); + const taxRateNames = Object.entries(TaxRates) + .filter(([, taxRateKeys]) => taxRateKeys.some((taxID) => taxRateIDs.includes(taxID))) + .map(([taxRate]) => taxRate); + displayQueryFilters = taxRateNames.map((taxRate) => ({ + operator: queryFilter[0].operator, + value: taxRate, + })); + } else { + displayQueryFilters = queryFilter.map((filter) => ({ + operator: filter.operator, + value: getDisplayValue(key, filter.value.toString(), PersonalDetails, cardList, reports), + })); + } title += buildFilterString(key, displayQueryFilters, ' '); }); From 9636f96d136919f14a4ee1b7b4c17533223c8e50 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Fri, 6 Sep 2024 12:38:07 +0200 Subject: [PATCH 5/7] SearchUtils file cleanup --- src/components/Search/types.ts | 1 + src/libs/SearchUtils.ts | 102 +++++++++++---------- src/libs/actions/Search.ts | 4 +- src/pages/Search/AdvancedSearchFilters.tsx | 2 +- 4 files changed, 58 insertions(+), 51 deletions(-) diff --git a/src/components/Search/types.ts b/src/components/Search/types.ts index 9f2aca1ff957..12aa0eb93cf9 100644 --- a/src/components/Search/types.ts +++ b/src/components/Search/types.ts @@ -69,6 +69,7 @@ type SearchQueryAST = { type SearchQueryJSON = { inputQuery: SearchQueryString; hash: number; + flatFilters: QueryFilters; } & SearchQueryAST; export type { diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 6c956b89f916..5c65d2157ca9 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -308,50 +308,6 @@ function getQueryHashFromString(query: SearchQueryString): number { return UserUtils.hashText(query, 2 ** 32); } -function buildSearchQueryJSON(query: SearchQueryString) { - try { - const result = searchParser.parse(query) as SearchQueryJSON; - - // Add the full input and hash to the results - result.inputQuery = query; - result.hash = getQueryHashFromString(query); - return result; - } catch (e) { - console.error(`Error when parsing SearchQuery: "${query}"`, e); - } -} - -function buildSearchQueryString(queryJSON?: SearchQueryJSON) { - const queryParts: string[] = []; - const defaultQueryJSON = buildSearchQueryJSON(''); - - for (const [, key] of Object.entries(CONST.SEARCH.SYNTAX_ROOT_KEYS)) { - const existingFieldValue = queryJSON?.[key]; - const queryFieldValue = existingFieldValue ?? defaultQueryJSON?.[key]; - - if (queryFieldValue) { - queryParts.push(`${key}:${queryFieldValue}`); - } - } - - if (!queryJSON) { - return queryParts.join(' '); - } - - const filters = getFilters(queryJSON); - - for (const [, filterKey] of Object.entries(CONST.SEARCH.SYNTAX_FILTER_KEYS)) { - const queryFilter = filters[filterKey]; - - if (queryFilter) { - const filterValueString = buildFilterString(filterKey, queryFilter); - queryParts.push(filterValueString); - } - } - - return queryParts.join(' '); -} - /** * Update string query with all the default params that are set by parser */ @@ -433,10 +389,56 @@ function getChatFiltersTranslationKey(has: ValueOf) { +function buildQueryStringFromFiltersValues(filterValues: Partial) { const filtersString = Object.entries(filterValues).map(([filterKey, filterValue]) => { if ((filterKey === FILTER_KEYS.MERCHANT || filterKey === FILTER_KEYS.DESCRIPTION || filterKey === FILTER_KEYS.REPORT_ID) && filterValue) { const keyInCorrectForm = (Object.keys(CONST.SEARCH.SYNTAX_FILTER_KEYS) as KeysOfFilterKeysObject[]).find((key) => CONST.SEARCH.SYNTAX_FILTER_KEYS[key] === filterKey); @@ -484,6 +486,11 @@ function buildQueryStringFromFilters(filterValues: Partial, TaxRates: Record, ) { - const filters = getFilters(queryJSON) ?? {}; + const filters = queryJSON.flatFilters ?? {}; let title = ''; Object.keys(filters).forEach((key) => { @@ -621,11 +628,10 @@ function isCannedSearchQuery(queryJSON: SearchQueryJSON) { } export { - buildQueryStringFromFilters, + buildQueryStringFromFiltersValues, buildSearchQueryJSON, buildSearchQueryString, getCurrentSearchParams, - getFilters, getPolicyIDFromSearchQuery, getListItem, getSearchHeaderTitle, diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 020fc1bd2c30..742e9fab1d8c 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -51,9 +51,9 @@ function getOnyxLoadingData(hash: number): {optimisticData: OnyxUpdate[]; finall function search({queryJSON, offset}: {queryJSON: SearchQueryJSON; offset?: number}) { const {optimisticData, finallyData} = getOnyxLoadingData(queryJSON.hash); - + const {flatFilters, ...queryJSONWithoutFlatFilters} = queryJSON; const queryWithOffset = { - ...queryJSON, + ...queryJSONWithoutFlatFilters, offset, }; const jsonQuery = JSON.stringify(queryWithOffset); diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx index 28567cfa8fe5..ce8886267ad5 100644 --- a/src/pages/Search/AdvancedSearchFilters.tsx +++ b/src/pages/Search/AdvancedSearchFilters.tsx @@ -246,7 +246,7 @@ function AdvancedSearchFilters() { const currentType = searchAdvancedFilters?.type ?? CONST.SEARCH.DATA_TYPES.EXPENSE; const onFormSubmit = () => { - const query = SearchUtils.buildQueryStringFromFilters(searchAdvancedFilters); + const query = SearchUtils.buildQueryStringFromFiltersValues(searchAdvancedFilters); SearchActions.clearAdvancedFilters(); Navigation.dismissModal(); Navigation.navigate( From 72dd8d4f319e5074960dc460837741586eb5dc23 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Fri, 6 Sep 2024 13:49:56 +0200 Subject: [PATCH 6/7] fix names --- src/libs/SearchUtils.ts | 4 ++-- src/pages/Search/AdvancedSearchFilters.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 5f7ca7c9b5f6..ff93db9daba5 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -450,7 +450,7 @@ function buildSearchQueryString(queryJSON?: SearchQueryJSON) { /** * Given object with chosen search filters builds correct query string from them */ -function buildQueryStringFromFiltersValues(filterValues: Partial) { +function buildQueryStringFromFilterValues(filterValues: Partial) { const filtersString = Object.entries(filterValues).map(([filterKey, filterValue]) => { if ((filterKey === FILTER_KEYS.MERCHANT || filterKey === FILTER_KEYS.DESCRIPTION || filterKey === FILTER_KEYS.REPORT_ID) && filterValue) { const keyInCorrectForm = (Object.keys(CONST.SEARCH.SYNTAX_FILTER_KEYS) as KeysOfFilterKeysObject[]).find((key) => CONST.SEARCH.SYNTAX_FILTER_KEYS[key] === filterKey); @@ -641,7 +641,7 @@ function isCannedSearchQuery(queryJSON: SearchQueryJSON) { } export { - buildQueryStringFromFiltersValues, + buildQueryStringFromFilterValues, buildSearchQueryJSON, buildSearchQueryString, getCurrentSearchParams, diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx index cb445ece8a91..9a278a0fe3d8 100644 --- a/src/pages/Search/AdvancedSearchFilters.tsx +++ b/src/pages/Search/AdvancedSearchFilters.tsx @@ -261,7 +261,7 @@ function AdvancedSearchFilters() { const currentType = searchAdvancedFilters?.type ?? CONST.SEARCH.DATA_TYPES.EXPENSE; const onFormSubmit = () => { - const query = SearchUtils.buildQueryStringFromFiltersValues(searchAdvancedFilters); + const query = SearchUtils.buildQueryStringFromFilterValues(searchAdvancedFilters); SearchActions.clearAdvancedFilters(); Navigation.dismissModal(); Navigation.navigate( From 8fc3c4e6505ad43a74a0bfbe5fc5c6e764129458 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Wed, 11 Sep 2024 10:56:08 +0200 Subject: [PATCH 7/7] restore type and status in header --- src/libs/SearchUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 399bc68a09a0..ffa3fe6b1eb4 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -694,8 +694,10 @@ function getSearchHeaderTitle( reports: OnyxCollection, TaxRates: Record, ) { + const {type, status} = queryJSON; const filters = queryJSON.flatFilters ?? {}; - let title = ''; + + let title = `type:${type} status:${status}`; Object.keys(filters).forEach((key) => { const queryFilter = filters[key as ValueOf] ?? [];