@@ -86,6 +86,7 @@ import {
8686 getIOUReportIDFromReportActionPreview ,
8787 getLastVisibleAction ,
8888 getLastVisibleMessage ,
89+ getOneTransactionThreadReportID ,
8990 getOriginalMessage ,
9091 getReportAction ,
9192 getReportActionHtml ,
@@ -653,6 +654,8 @@ type GetSearchOnyxUpdateParams = {
653654 transaction : OnyxTypes . Transaction ;
654655 participant ?: Participant ;
655656 iouReport ?: OnyxEntry < OnyxTypes . Report > ;
657+ policy ?: OnyxEntry < OnyxTypes . Policy > ;
658+ isFromOneTransactionReport ?: boolean ;
656659 isInvoice ?: boolean ;
657660 transactionThreadReportID : string | undefined ;
658661} ;
@@ -1888,11 +1891,15 @@ function buildOnyxDataForMoneyRequest(moneyRequestParams: BuildOnyxDataForMoneyR
18881891 } ) ;
18891892 }
18901893
1894+ const reportActions = fastMerge ( allReportActions ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iou . report . reportID } ` ] ?? { } , { [ iou . action . reportActionID ] : iou . action } , true ) ;
1895+ const isFromOneTransactionReport = ! ! getOneTransactionThreadReportID ( iou . report , chat . report ?? undefined , reportActions , undefined , undefined ) ;
18911896 const searchUpdate = getSearchOnyxUpdate ( {
18921897 transaction,
18931898 participant,
1894- iouReport : shouldCreateNewMoneyRequestReport ? iou . report : undefined ,
1899+ iouReport : iou . report ,
1900+ policy,
18951901 transactionThreadReportID : transactionThreadReport ?. reportID ,
1902+ isFromOneTransactionReport,
18961903 } ) ;
18971904
18981905 if ( searchUpdate ) {
@@ -11306,7 +11313,15 @@ function resolveDuplicates(params: MergeDuplicatesParams) {
1130611313 API . write ( WRITE_COMMANDS . RESOLVE_DUPLICATES , parameters , { optimisticData, failureData} ) ;
1130711314}
1130811315
11309- function getSearchOnyxUpdate ( { participant, transaction, iouReport, transactionThreadReportID, isInvoice} : GetSearchOnyxUpdateParams ) : OnyxData | undefined {
11316+ function getSearchOnyxUpdate ( {
11317+ participant,
11318+ transaction,
11319+ iouReport,
11320+ policy,
11321+ transactionThreadReportID,
11322+ isFromOneTransactionReport,
11323+ isInvoice,
11324+ } : GetSearchOnyxUpdateParams ) : OnyxData | undefined {
1131011325 const toAccountID = participant ?. accountID ;
1131111326 const fromAccountID = currentUserPersonalDetails ?. accountID ;
1131211327 const currentSearchQueryJSON = getCurrentSearchQueryJSON ( ) ;
@@ -11337,7 +11352,6 @@ function getSearchOnyxUpdate({participant, transaction, iouReport, transactionTh
1133711352 } ,
1133811353 } ,
1133911354 } ,
11340- ...( iouReport ? { [ `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReport . reportID } ` ] : iouReport } : { } ) ,
1134111355 } ,
1134211356 } ) ;
1134311357 }
@@ -11365,8 +11379,11 @@ function getSearchOnyxUpdate({participant, transaction, iouReport, transactionTh
1136511379 accountID : fromAccountID ,
1136611380 managerID : toAccountID ,
1136711381 ...( transactionThreadReportID && { transactionThreadReportID} ) ,
11382+ ...( isFromOneTransactionReport && { isFromOneTransactionReport} ) ,
1136811383 ...transaction ,
1136911384 } ,
11385+ ...( policy && { [ `${ ONYXKEYS . COLLECTION . POLICY } ${ policy . id } ` ] : policy } ) ,
11386+ ...( iouReport && { [ `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReport . reportID } ` ] : iouReport } ) ,
1137011387 } ,
1137111388 } ,
1137211389 } ,
0 commit comments