diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 46845dce8a1e..1c2e18a885ae 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3299,6 +3299,50 @@ function completeOnboarding( return acc; }, []); + const tasksForSuccessData = tasksData.reduce((acc, {currentTask, taskCreatedAction, taskReportAction, completedTaskReportAction}) => { + acc.push( + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`, + value: { + [taskReportAction.reportAction.reportActionID]: {pendingAction: null}, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${currentTask.reportID}`, + value: { + pendingFields: { + createChat: null, + reportName: null, + description: null, + managerID: null, + }, + isOptimisticReport: false, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${currentTask.reportID}`, + value: { + [taskCreatedAction.reportActionID]: {pendingAction: null}, + }, + }, + ); + + if (completedTaskReportAction) { + acc.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${currentTask.reportID}`, + value: { + [completedTaskReportAction.reportActionID]: {pendingAction: null}, + }, + }); + } + + return acc; + }, []); + const optimisticData: OnyxUpdate[] = [ ...tasksForOptimisticData, { @@ -3323,6 +3367,7 @@ function completeOnboarding( }, ]; const successData: OnyxUpdate[] = [ + ...tasksForSuccessData, { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,