diff --git a/src/components/SelectionList/SearchTableHeader.tsx b/src/components/SelectionList/SearchTableHeader.tsx index 6ba753273e8c..73bfff912ccd 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, metadata) => metadata?.columnsToShow.shouldShowCategoryColumn ?? false, + shouldShow: (data, metadata) => metadata?.columnsToShow?.shouldShowCategoryColumn ?? false, }, { columnName: CONST.SEARCH.TABLE_COLUMNS.TAG, translationKey: 'common.tag', - shouldShow: (data, metadata) => metadata?.columnsToShow.shouldShowTagColumn ?? false, + shouldShow: (data, metadata) => metadata?.columnsToShow?.shouldShowTagColumn ?? false, }, { columnName: CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT, translationKey: 'common.tax', - shouldShow: (data, metadata) => metadata?.columnsToShow.shouldShowTaxColumn ?? false, + shouldShow: (data, metadata) => metadata?.columnsToShow?.shouldShowTaxColumn ?? false, isColumnSortable: false, }, { diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 460a686766a7..d90f53c7d381 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -138,9 +138,9 @@ function getTransactionsSections(data: OnyxTypes.SearchResults['data'], metadata formattedMerchant, date, shouldShowMerchant, - shouldShowCategory: metadata?.columnsToShow.shouldShowCategoryColumn, - shouldShowTag: metadata?.columnsToShow.shouldShowTagColumn, - shouldShowTax: metadata?.columnsToShow.shouldShowTaxColumn, + shouldShowCategory: metadata?.columnsToShow?.shouldShowCategoryColumn, + shouldShowTag: metadata?.columnsToShow?.shouldShowTagColumn, + shouldShowTax: metadata?.columnsToShow?.shouldShowTaxColumn, keyForList: transactionItem.transactionID, shouldShowYear: doesDataContainAPastYearTransaction, }; @@ -185,9 +185,9 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx formattedMerchant, date, shouldShowMerchant, - shouldShowCategory: metadata?.columnsToShow.shouldShowCategoryColumn, - shouldShowTag: metadata?.columnsToShow.shouldShowTagColumn, - shouldShowTax: metadata?.columnsToShow.shouldShowTaxColumn, + shouldShowCategory: metadata?.columnsToShow?.shouldShowCategoryColumn, + shouldShowTag: metadata?.columnsToShow?.shouldShowTagColumn, + shouldShowTax: metadata?.columnsToShow?.shouldShowTaxColumn, keyForList: transactionItem.transactionID, shouldShowYear: doesDataContainAPastYearTransaction, };