Skip to content

Commit

Permalink
Merge pull request Expensify#44627 from neonbhai/search-optional-chai…
Browse files Browse the repository at this point in the history
…ning-fix

Add optional chaining for shouldShowColumns data
  • Loading branch information
luacmartins authored Jul 2, 2024
2 parents fbd7d7e + 3fc993d commit cb1b452
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/components/SelectionList/SearchTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
{
Expand Down
12 changes: 6 additions & 6 deletions src/libs/SearchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit cb1b452

Please sign in to comment.