@@ -5737,27 +5737,28 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo
5737
5737
// build Onyx data
5738
5738
5739
5739
// Onyx operations to delete the transaction, update the IOU report action and chat report action
5740
+ const reportActionsOnyxUpdates : OnyxUpdate [ ] = [ ] ;
5740
5741
const onyxUpdates : OnyxUpdate [ ] = [
5741
5742
{
5742
5743
onyxMethod : Onyx . METHOD . SET ,
5743
5744
key : `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` ,
5744
5745
value : null ,
5745
5746
} ,
5746
- {
5747
- onyxMethod : Onyx . METHOD . MERGE ,
5748
- key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport ?. reportID } ` ,
5749
- value : {
5750
- [ reportAction . reportActionID ] : shouldDeleteIOUReport
5751
- ? null
5752
- : {
5753
- pendingAction : null ,
5754
- } ,
5755
- } ,
5756
- } ,
5757
5747
] ;
5748
+ reportActionsOnyxUpdates . push ( {
5749
+ onyxMethod : Onyx . METHOD . MERGE ,
5750
+ key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport ?. reportID } ` ,
5751
+ value : {
5752
+ [ reportAction . reportActionID ] : shouldDeleteIOUReport
5753
+ ? null
5754
+ : {
5755
+ pendingAction : null ,
5756
+ } ,
5757
+ } ,
5758
+ } ) ;
5758
5759
5759
5760
if ( reportPreviewAction ?. reportActionID ) {
5760
- onyxUpdates . push ( {
5761
+ reportActionsOnyxUpdates . push ( {
5761
5762
onyxMethod : Onyx . METHOD . MERGE ,
5762
5763
key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ chatReport ?. reportID } ` ,
5763
5764
value : {
@@ -5794,12 +5795,12 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo
5794
5795
}
5795
5796
5796
5797
// added operations to update IOU report and chat report
5798
+ reportActionsOnyxUpdates . push ( {
5799
+ onyxMethod : Onyx . METHOD . MERGE ,
5800
+ key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport ?. reportID } ` ,
5801
+ value : updatedReportAction ,
5802
+ } ) ;
5797
5803
onyxUpdates . push (
5798
- {
5799
- onyxMethod : Onyx . METHOD . MERGE ,
5800
- key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport ?. reportID } ` ,
5801
- value : updatedReportAction ,
5802
- } ,
5803
5804
{
5804
5805
onyxMethod : Onyx . METHOD . MERGE ,
5805
5806
key : `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReport ?. reportID } ` ,
@@ -5850,9 +5851,14 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo
5850
5851
) ;
5851
5852
}
5852
5853
5853
- Onyx . update ( onyxUpdates ) ;
5854
-
5855
- return urlToNavigateBack ;
5854
+ // First, update the reportActions to ensure related actions are not displayed.
5855
+ Onyx . update ( reportActionsOnyxUpdates ) . then ( ( ) => {
5856
+ Navigation . goBack ( urlToNavigateBack ) ;
5857
+ InteractionManager . runAfterInteractions ( ( ) => {
5858
+ // After navigation, update the remaining data.
5859
+ Onyx . update ( onyxUpdates ) ;
5860
+ } ) ;
5861
+ } ) ;
5856
5862
}
5857
5863
5858
5864
/**
0 commit comments