From 52aa9a953167814edab2b49fda9ed5df51200d40 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 30 Sep 2024 14:51:35 +0300 Subject: [PATCH] renamed variable and avoided unnecessary clearing onyx task data --- src/libs/actions/Task.ts | 7 +++---- src/pages/home/report/ReportFooter.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) 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],