@@ -26,7 +26,7 @@ const columnNamesToSortingProperty = {
26
26
[ CONST . SEARCH . TABLE_COLUMNS . CATEGORY ] : 'category' as const ,
27
27
[ CONST . SEARCH . TABLE_COLUMNS . TYPE ] : 'type' as const ,
28
28
[ CONST . SEARCH . TABLE_COLUMNS . ACTION ] : 'action' as const ,
29
- [ CONST . SEARCH . TABLE_COLUMNS . DESCRIPTION ] : 'comment.comment ' as const ,
29
+ [ CONST . SEARCH . TABLE_COLUMNS . DESCRIPTION ] : 'comment' as const ,
30
30
[ CONST . SEARCH . TABLE_COLUMNS . TAX_AMOUNT ] : null ,
31
31
[ CONST . SEARCH . TABLE_COLUMNS . RECEIPT ] : null ,
32
32
} ;
@@ -242,10 +242,6 @@ function getQueryHash(query: string, policyID?: string, sortBy?: string, sortOrd
242
242
return UserUtils . hashText ( textToHash , 2 ** 32 ) ;
243
243
}
244
244
245
- const getNestedValue = ( obj : any , path : string ) => {
246
- return path . split ( '.' ) . reduce ( ( acc , part ) => acc && acc [ part ] , obj ) ;
247
- } ;
248
-
249
245
function getSortedTransactionData ( data : TransactionListItemType [ ] , sortBy ?: SearchColumnType , sortOrder ?: SortOrder ) {
250
246
if ( ! sortBy || ! sortOrder ) {
251
247
return data ;
@@ -258,8 +254,8 @@ function getSortedTransactionData(data: TransactionListItemType[], sortBy?: Sear
258
254
}
259
255
260
256
return data . sort ( ( a , b ) => {
261
- const aValue = getNestedValue ( a , sortingProperty ) ;
262
- const bValue = getNestedValue ( b , sortingProperty ) ;
257
+ const aValue = sortingProperty === 'comment' ? a . comment . comment : a [ sortingProperty ] ;
258
+ const bValue = sortingProperty === 'comment' ? b . comment . comment : b [ sortingProperty ] ;
263
259
264
260
if ( aValue === undefined || bValue === undefined ) {
265
261
return 0 ;
0 commit comments