@@ -2276,10 +2276,9 @@ function prepareReportOptionsForDisplay(
22762276 currentUserAccountID : number ,
22772277 config : GetValidReportsConfig ,
22782278 conciergeReportID : string | undefined ,
2279+ sortedActions : Record < string , ReportAction [ ] > | undefined ,
22792280 visibleReportActionsData : VisibleReportActionsDerivedValue = { } ,
22802281 reportAttributesDerived ?: ReportAttributesDerivedValue [ 'reports' ] ,
2281- // eslint-disable-next-line @typescript-eslint/no-deprecated
2282- sortedActions : Record < string , ReportAction [ ] > = deprecatedAllSortedReportActions ,
22832282 policyTags ?: OnyxCollection < PolicyTagLists > ,
22842283) : Array < SearchOption < Report > > {
22852284 const {
@@ -2333,7 +2332,7 @@ function prepareReportOptionsForDisplay(
23332332 const chatReport = allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ report . chatReportID } ` ] ;
23342333 const oneTransactionThreadReportID =
23352334 report . type === CONST . REPORT . TYPE . IOU || report . type === CONST . REPORT . TYPE . EXPENSE || report . type === CONST . REPORT . TYPE . INVOICE
2336- ? getOneTransactionThreadReportID ( report , chatReport , sortedActions [ report . reportID ] )
2335+ ? getOneTransactionThreadReportID ( report , chatReport , sortedActions ?. [ report . reportID ] )
23372336 : undefined ;
23382337 const oneTransactionThreadReport = oneTransactionThreadReportID ? allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ oneTransactionThreadReportID } ` ] : undefined ;
23392338
@@ -2343,11 +2342,11 @@ function prepareReportOptionsForDisplay(
23432342 let lastIOUCreationDate ;
23442343 // Add a field to sort the recent reports by the time of last IOU request for create actions
23452344 if ( preferRecentExpenseReports ) {
2346- const reportPreviewAction = sortedActions [ option . reportID ] ?. find ( ( reportAction ) => isActionOfType ( reportAction , CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW ) ) ;
2345+ const reportPreviewAction = sortedActions ?. [ option . reportID ] ?. find ( ( reportAction ) => isActionOfType ( reportAction , CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW ) ) ;
23472346
23482347 if ( reportPreviewAction ) {
23492348 const iouReportID = getIOUReportIDFromReportActionPreview ( reportPreviewAction ) ;
2350- const iouReportActions = iouReportID ? ( sortedActions [ iouReportID ] ?? [ ] ) : [ ] ;
2349+ const iouReportActions = iouReportID ? ( sortedActions ?. [ iouReportID ] ?? [ ] ) : [ ] ;
23512350 const lastIOUAction = iouReportActions . find ( ( iouAction ) => iouAction . actionName === CONST . REPORT . ACTIONS . TYPE . IOU ) ;
23522351 if ( lastIOUAction ) {
23532352 lastIOUCreationDate = lastIOUAction . lastModified ;
@@ -2574,9 +2573,9 @@ function getValidOptions(
25742573 personalDetails,
25752574 } ,
25762575 conciergeReportID ,
2576+ sortedActions ,
25772577 visibleReportActionsData ,
25782578 reportAttributesDerived ,
2579- sortedActions ,
25802579 allPolicyTags ,
25812580 ) . at ( 0 ) ;
25822581 }
@@ -2598,9 +2597,9 @@ function getValidOptions(
25982597 personalDetails,
25992598 } ,
26002599 conciergeReportID ,
2600+ sortedActions ,
26012601 visibleReportActionsData ,
26022602 reportAttributesDerived ,
2603- sortedActions ,
26042603 allPolicyTags ,
26052604 ) ;
26062605
@@ -2618,9 +2617,9 @@ function getValidOptions(
26182617 personalDetails,
26192618 } ,
26202619 conciergeReportID ,
2620+ sortedActions ,
26212621 visibleReportActionsData ,
26222622 reportAttributesDerived ,
2623- sortedActions ,
26242623 allPolicyTags ,
26252624 ) ;
26262625 } else if ( recentAttendees && recentAttendees ?. length > 0 ) {
@@ -2754,6 +2753,7 @@ type SearchOptionsConfig = {
27542753 personalDetails ?: OnyxEntry < PersonalDetailsList > ;
27552754 reportAttributesDerived ?: ReportAttributesDerivedValue [ 'reports' ] ;
27562755 allPolicyTags ?: OnyxCollection < PolicyTagLists > ;
2756+ sortedActions : Record < string , ReportAction [ ] > | undefined ;
27572757 conciergeReportID : string | undefined ;
27582758} ;
27592759
@@ -2783,6 +2783,7 @@ function getSearchOptions({
27832783 reportAttributesDerived,
27842784 personalDetails,
27852785 allPolicyTags,
2786+ sortedActions,
27862787 conciergeReportID,
27872788} : SearchOptionsConfig ) : Options {
27882789 const optionList = getValidOptions ( options , policyCollection , draftComments , nvpDismissedProductTraining , loginList , currentUserAccountID , currentUserEmail , conciergeReportID , {
@@ -2810,6 +2811,7 @@ function getSearchOptions({
28102811 visibleReportActionsData,
28112812 reportAttributesDerived,
28122813 allPolicyTags,
2814+ sortedActions,
28132815 } ) ;
28142816
28152817 return optionList ;
0 commit comments