@@ -323,12 +323,20 @@ function getPayMoneyRequestParams({
323323 } ;
324324 }
325325
326- onyxData . optimisticData ?. push (
327- {
326+ if ( ! isFallbackChatReport ) {
327+ onyxData . optimisticData ?. push ( {
328328 onyxMethod : Onyx . METHOD . MERGE ,
329329 key : `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReport . reportID } ` ,
330330 value : optimisticChatReport ,
331- } ,
331+ } ) ;
332+ onyxData . failureData ?. push ( {
333+ onyxMethod : Onyx . METHOD . MERGE ,
334+ key : `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReport . reportID } ` ,
335+ value : chatReport ,
336+ } ) ;
337+ }
338+
339+ onyxData . optimisticData ?. push (
332340 {
333341 onyxMethod : Onyx . METHOD . MERGE ,
334342 key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ iouReport ?. reportID } ` ,
@@ -424,19 +432,6 @@ function getPayMoneyRequestParams({
424432 ...iouReport ,
425433 } ,
426434 } ,
427- isFallbackChatReport
428- ? {
429- // The fallback chat report didn't exist in Onyx before the optimistic update, so restore that state.
430- // Re-merging the fallback object can't undo the optimistic paid-state fields.
431- onyxMethod : Onyx . METHOD . SET ,
432- key : `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReport . reportID } ` ,
433- value : null ,
434- }
435- : {
436- onyxMethod : Onyx . METHOD . MERGE ,
437- key : `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReport . reportID } ` ,
438- value : chatReport ,
439- } ,
440435 ) ;
441436
442437 // In case the report preview action is loaded locally, let's update it.
0 commit comments