Skip to content

Commit

Permalink
renamed variable and avoided unnecessary clearing onyx task data
Browse files Browse the repository at this point in the history
  • Loading branch information
FitseTLT committed Sep 30, 2024
1 parent 4944e69 commit 52aa9a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function createTaskAndNavigate(
assigneeAccountID = 0,
assigneeChatReport?: OnyxEntry<OnyxTypes.Report>,
policyID: string = CONST.POLICY.OWNER_EMAIL_FAKE,
shouldNavigate = true,
isCreatedUsingMarkdown = false,
) {
const optimisticTaskReport = ReportUtils.buildOptimisticTaskReport(currentUserAccountID, assigneeAccountID, parentReportID, title, description, policyID);

Expand Down Expand Up @@ -278,8 +278,6 @@ function createTaskAndNavigate(
},
});

clearOutTaskInfo();

const parameters: CreateTaskParams = {
parentReportActionID: optimisticAddCommentReport.reportAction.reportActionID,
parentReportID,
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 52aa9a9

Please sign in to comment.