Skip to content

Commit

Permalink
Merge pull request Expensify#49865 from FitseTLT/fix-navigation-bug-o…
Browse files Browse the repository at this point in the history
…n-creating-task-on-search

Fix - Search - App returns to Inbox after assigning task in chat report RHP in Search
  • Loading branch information
grgia authored Oct 1, 2024
2 parents 8f08755 + 52aa9a9 commit 7f0bdf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function createTaskAndNavigate(
assigneeAccountID = 0,
assigneeChatReport?: OnyxEntry<OnyxTypes.Report>,
policyID: string = CONST.POLICY.OWNER_EMAIL_FAKE,
isCreatedUsingMarkdown = false,
) {
const optimisticTaskReport = ReportUtils.buildOptimisticTaskReport(currentUserAccountID, assigneeAccountID, parentReportID, title, description, policyID);

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

clearOutTaskInfo();

const parameters: CreateTaskParams = {
parentReportActionID: optimisticAddCommentReport.reportAction.reportActionID,
parentReportID,
Expand All @@ -295,7 +294,10 @@ function createTaskAndNavigate(

API.write(WRITE_COMMANDS.CREATE_TASK, parameters, {optimisticData, successData, failureData});

Navigation.dismissModal(parentReportID);
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 @@ -161,7 +161,7 @@ function ReportFooter({
title = `@${mentionWithDomain} ${title}`;
}
}
Task.createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID);
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 7f0bdf0

Please sign in to comment.