diff --git a/src/components/SelectionList/SearchTableHeader.tsx b/src/components/SelectionList/SearchTableHeader.tsx index 913ceb914eb..c0bf8874eb0 100644 --- a/src/components/SelectionList/SearchTableHeader.tsx +++ b/src/components/SelectionList/SearchTableHeader.tsx @@ -53,17 +53,17 @@ const SearchColumns: SearchColumnConfig[] = [ { columnName: CONST.SEARCH_TABLE_COLUMNS.CATEGORY, translationKey: 'common.category', - shouldShow: (data: OnyxTypes.SearchResults['data']) => SearchUtils.getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.CATEGORY), + shouldShow: () => true, }, { columnName: CONST.SEARCH_TABLE_COLUMNS.TAG, translationKey: 'common.tag', - shouldShow: (data: OnyxTypes.SearchResults['data']) => SearchUtils.getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.TAG), + shouldShow: () => true, }, { columnName: CONST.SEARCH_TABLE_COLUMNS.TAX_AMOUNT, translationKey: 'common.tax', - shouldShow: (data: OnyxTypes.SearchResults['data']) => SearchUtils.getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.TAX_AMOUNT), + shouldShow: () => true, isColumnSortable: false, }, { diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index b63147b8113..a5d2ac1d9df 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -76,15 +76,8 @@ function getShouldShowMerchant(data: OnyxTypes.SearchResults['data']): boolean { }); } -function getShouldShowColumn(data: OnyxTypes.SearchResults['data'], columnName: ValueOf) { - return Object.values(data).some((item) => !!item[columnName]); -} - function getTransactionsSections(data: OnyxTypes.SearchResults['data']): TransactionListItemType[] { const shouldShowMerchant = getShouldShowMerchant(data); - const shouldShowCategory = getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.CATEGORY); - const shouldShowTag = getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.TAG); - const shouldShowTax = getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.TAX_AMOUNT); return Object.entries(data) .filter(([key]) => key.startsWith(ONYXKEYS.COLLECTION.TRANSACTION)) @@ -107,9 +100,9 @@ function getTransactionsSections(data: OnyxTypes.SearchResults['data']): Transac formattedMerchant, date, shouldShowMerchant, - shouldShowCategory, - shouldShowTag, - shouldShowTax, + shouldShowCategory: true, + shouldShowTag: true, + shouldShowTax: true, keyForList: transactionItem.transactionID, }; }); @@ -117,9 +110,6 @@ function getTransactionsSections(data: OnyxTypes.SearchResults['data']): Transac function getReportSections(data: OnyxTypes.SearchResults['data']): ReportListItemType[] { const shouldShowMerchant = getShouldShowMerchant(data); - const shouldShowCategory = getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.CATEGORY); - const shouldShowTag = getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.TAG); - const shouldShowTax = getShouldShowColumn(data, CONST.SEARCH_TABLE_COLUMNS.TAX_AMOUNT); const reportIDToTransactions: Record = {}; for (const key in data) { @@ -152,9 +142,9 @@ function getReportSections(data: OnyxTypes.SearchResults['data']): ReportListIte formattedMerchant, date, shouldShowMerchant, - shouldShowCategory, - shouldShowTag, - shouldShowTax, + shouldShowCategory: true, + shouldShowTag: true, + shouldShowTax: true, keyForList: transactionItem.transactionID, }; if (reportIDToTransactions[reportKey]?.transactions) { @@ -240,5 +230,5 @@ function getSearchParams() { return topmostCentralPaneRoute?.params as CentralPaneNavigatorParamList['Search_Central_Pane']; } -export {getListItem, getQueryHash, getSections, getSortedSections, getShouldShowColumn, getShouldShowMerchant, getSearchType, getSearchParams}; +export {getListItem, getQueryHash, getSections, getSortedSections, getShouldShowMerchant, getSearchType, getSearchParams}; export type {SearchColumnType, SortOrder};