@@ -967,6 +967,7 @@ function openReport(
967967 transaction ?: Transaction ,
968968 transactionViolations ?: TransactionViolations ,
969969 parentReportID ?: string ,
970+ shouldAddPendingFields = true ,
970971 optimisticSelfDMReport ?: Report ,
971972) {
972973 if ( ! reportID ) {
@@ -1232,10 +1233,12 @@ function openReport(
12321233 ...optimisticReport ,
12331234 reportName : CONST . REPORT . DEFAULT_REPORT_NAME ,
12341235 ...newReportObject ,
1235- pendingFields : {
1236- createChat : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
1237- ...( isGroupChat && { reportName : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD } ) ,
1238- } ,
1236+ pendingFields : shouldAddPendingFields
1237+ ? {
1238+ createChat : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
1239+ ...( isGroupChat && { reportName : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD } ) ,
1240+ }
1241+ : undefined ,
12391242 } ;
12401243 }
12411244
@@ -1248,7 +1251,7 @@ function openReport(
12481251 {
12491252 onyxMethod : Onyx . METHOD . SET ,
12501253 key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ,
1251- value : { [ optimisticCreatedAction . reportActionID ] : optimisticCreatedAction } ,
1254+ value : { [ optimisticCreatedAction . reportActionID ] : { ... optimisticCreatedAction , pendingAction : shouldAddPendingFields ? CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD : null } } ,
12521255 } ,
12531256 {
12541257 onyxMethod : Onyx . METHOD . SET ,
@@ -1437,6 +1440,7 @@ function createTransactionThreadReport(
14371440
14381441 const optimisticTransactionThreadReportID = generateReportID ( ) ;
14391442 const optimisticTransactionThread = buildTransactionThread ( iouReportAction , reportToUse , undefined , optimisticTransactionThreadReportID ) ;
1443+ const shouldAddPendingFields = transaction ?. pendingAction === CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD || iouReportAction ?. pendingAction === CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ;
14401444 openReport (
14411445 optimisticTransactionThreadReportID ,
14421446 undefined ,
@@ -1450,6 +1454,7 @@ function createTransactionThreadReport(
14501454 transaction ,
14511455 transactionViolations ,
14521456 selfDMReportID ,
1457+ shouldAddPendingFields ,
14531458 optimisticSelfDMReport ,
14541459 ) ;
14551460 return optimisticTransactionThread ;
0 commit comments