@@ -127,17 +127,11 @@ function mapTransactionItemToSelectedEntry(item: TransactionListItemType, outsta
127127 ] ;
128128}
129129
130- function mapToTransactionItemWithAdditionalInfo (
131- item : TransactionListItemType ,
132- selectedTransactions : SelectedTransactions ,
133- canSelectMultiple : boolean ,
134- shouldAnimateInHighlight : boolean ,
135- hash ?: number ,
136- ) {
137- return { ...item , shouldAnimateInHighlight, isSelected : selectedTransactions [ item . keyForList ] ?. isSelected && canSelectMultiple , hash} ;
130+ function mapToTransactionItemWithAdditionalInfo ( item : TransactionListItemType , shouldAnimateInHighlight : boolean , hash ?: number ) {
131+ return { ...item , shouldAnimateInHighlight, hash} ;
138132}
139133
140- function mapToItemWithAdditionalInfo ( item : SearchListItem , selectedTransactions : SelectedTransactions , canSelectMultiple : boolean , shouldAnimateInHighlight : boolean , hash ?: number ) {
134+ function mapToItemWithAdditionalInfo ( item : SearchListItem , shouldAnimateInHighlight : boolean , hash ?: number ) {
141135 if ( isTaskListItemType ( item ) ) {
142136 return {
143137 ...item ,
@@ -155,16 +149,10 @@ function mapToItemWithAdditionalInfo(item: SearchListItem, selectedTransactions:
155149 }
156150
157151 return isTransactionListItemType ( item )
158- ? mapToTransactionItemWithAdditionalInfo ( item , selectedTransactions , canSelectMultiple , shouldAnimateInHighlight , hash )
152+ ? mapToTransactionItemWithAdditionalInfo ( item , shouldAnimateInHighlight , hash )
159153 : {
160154 ...item ,
161155 shouldAnimateInHighlight,
162- transactions : item . transactions ?. map ( ( transaction ) =>
163- mapToTransactionItemWithAdditionalInfo ( transaction , selectedTransactions , canSelectMultiple , shouldAnimateInHighlight , hash ) ,
164- ) ,
165- isSelected :
166- item ?. transactions ?. length > 0 &&
167- item . transactions ?. filter ( ( t ) => ! isTransactionPendingDelete ( t ) ) . every ( ( transaction ) => selectedTransactions [ transaction . keyForList ] ?. isSelected && canSelectMultiple ) ,
168156 hash,
169157 } ;
170158}
@@ -807,7 +795,7 @@ function Search({
807795 const canSelectMultiple = ! isChat && ! isTask && ( ! isSmallScreenWidth || isMobileSelectionModeEnabled ) && validGroupBy !== CONST . SEARCH . GROUP_BY . WITHDRAWAL_ID ;
808796 const ListItem = getListItem ( type , status , validGroupBy ) ;
809797
810- const sortedSelectedData = useMemo (
798+ const sortedData = useMemo (
811799 ( ) =>
812800 getSortedSections ( type , status , filteredData , localeCompare , sortBy , sortOrder , validGroupBy ) . map ( ( item ) => {
813801 const baseKey = isChat
@@ -828,9 +816,9 @@ function Search({
828816 // Determine if either the base key or any transaction key matches
829817 const shouldAnimateInHighlight = isBaseKeyMatch || isAnyTransactionMatch ;
830818
831- return mapToItemWithAdditionalInfo ( item , selectedTransactions , canSelectMultiple , shouldAnimateInHighlight , hash ) ;
819+ return mapToItemWithAdditionalInfo ( item , shouldAnimateInHighlight , hash ) ;
832820 } ) ,
833- [ type , status , filteredData , sortBy , sortOrder , validGroupBy , isChat , newSearchResultKeys , selectedTransactions , canSelectMultiple , localeCompare , hash ] ,
821+ [ type , status , filteredData , sortBy , sortOrder , validGroupBy , isChat , newSearchResultKeys , localeCompare , hash ] ,
834822 ) ;
835823
836824 useEffect ( ( ) => {
@@ -891,8 +879,8 @@ function Search({
891879
892880 const onLayout = useCallback ( ( ) => {
893881 endSpan ( CONST . TELEMETRY . SPAN_NAVIGATE_TO_REPORTS_TAB ) ;
894- handleSelectionListScroll ( sortedSelectedData , searchListRef . current ) ;
895- } , [ handleSelectionListScroll , sortedSelectedData ] ) ;
882+ handleSelectionListScroll ( sortedData , searchListRef . current ) ;
883+ } , [ handleSelectionListScroll , sortedData ] ) ;
896884
897885 const areAllOptionalColumnsHidden = useMemo ( ( ) => {
898886 const canBeMissingColumns = expenseHeaders . filter ( ( header ) => header . canBeMissing ) . map ( ( header ) => header . columnName ) ;
@@ -972,12 +960,13 @@ function Search({
972960 < Animated . View style = { [ styles . flex1 , animatedStyle ] } >
973961 < SearchList
974962 ref = { searchListRef }
975- data = { sortedSelectedData }
963+ data = { sortedData }
976964 ListItem = { ListItem }
977965 onSelectRow = { onSelectRow }
978966 onCheckboxPress = { toggleTransaction }
979967 onAllCheckboxPress = { toggleAllTransactions }
980968 canSelectMultiple = { canSelectMultiple }
969+ selectedTransactions = { selectedTransactions }
981970 shouldPreventLongPressRow = { isChat || isTask }
982971 isFocused = { isFocused }
983972 onDEWModalOpen = { handleDEWModalOpen }
0 commit comments