Skip to content

Commit

Permalink
Merge pull request #44472 from Expensify/cmartins-fixDescriptionSort
Browse files Browse the repository at this point in the history
Fix description sort
  • Loading branch information
srikarparsi authored Jun 26, 2024
2 parents ba6e2be + 4041963 commit e039da9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libs/SearchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const columnNamesToSortingProperty = {
[CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: 'category' as const,
[CONST.SEARCH.TABLE_COLUMNS.TYPE]: 'type' as const,
[CONST.SEARCH.TABLE_COLUMNS.ACTION]: 'action' as const,
[CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: null,
[CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: 'comment' as const,
[CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: null,
[CONST.SEARCH.TABLE_COLUMNS.RECEIPT]: null,
};
Expand Down Expand Up @@ -254,8 +254,8 @@ function getSortedTransactionData(data: TransactionListItemType[], sortBy?: Sear
}

return data.sort((a, b) => {
const aValue = a[sortingProperty];
const bValue = b[sortingProperty];
const aValue = sortingProperty === 'comment' ? a.comment.comment : a[sortingProperty];
const bValue = sortingProperty === 'comment' ? b.comment.comment : b[sortingProperty];

if (aValue === undefined || bValue === undefined) {
return 0;
Expand Down

0 comments on commit e039da9

Please sign in to comment.