diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index d79fb8cd336f..342fad605611 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -113,7 +113,7 @@ function createTaskAndNavigate( assigneeAccountID = 0, assigneeChatReport?: OnyxEntry, policyID: string = CONST.POLICY.OWNER_EMAIL_FAKE, - shouldNavigate = true, + isCreatedUsingMarkdown = false, ) { const optimisticTaskReport = ReportUtils.buildOptimisticTaskReport(currentUserAccountID, assigneeAccountID, parentReportID, title, description, policyID); @@ -278,8 +278,6 @@ function createTaskAndNavigate( }, }); - clearOutTaskInfo(); - const parameters: CreateTaskParams = { parentReportActionID: optimisticAddCommentReport.reportAction.reportActionID, parentReportID, @@ -296,7 +294,8 @@ function createTaskAndNavigate( API.write(WRITE_COMMANDS.CREATE_TASK, parameters, {optimisticData, successData, failureData}); - if (shouldNavigate) { + if (!isCreatedUsingMarkdown) { + clearOutTaskInfo(); Navigation.dismissModal(parentReportID); } Report.notifyNewAction(parentReportID, currentUserAccountID); diff --git a/src/pages/home/report/ReportFooter.tsx b/src/pages/home/report/ReportFooter.tsx index 088e087c28ac..97820738017c 100644 --- a/src/pages/home/report/ReportFooter.tsx +++ b/src/pages/home/report/ReportFooter.tsx @@ -154,7 +154,7 @@ function ReportFooter({ assigneeChatReport = optimisticDataForNewAssignee.assigneeReport; } } - Task.createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID, false); + Task.createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID, true); return true; }, [allPersonalDetails, report.policyID, report.reportID],