Skip to content

Commit

Permalink
Merge pull request #53051 from daledah/fix/52669
Browse files Browse the repository at this point in the history
fix: Header - Approve button appears briefly when it shouldn't
  • Loading branch information
francoisl authored Dec 4, 2024
2 parents 08d8072 + 0537b11 commit 25bd09c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7392,6 +7392,8 @@ function submitReport(expenseReport: OnyxTypes.Report) {
const adminAccountID = policy?.role === CONST.POLICY.ROLE.ADMIN ? currentUserPersonalDetails?.accountID : undefined;
const optimisticSubmittedReportAction = ReportUtils.buildOptimisticSubmittedReportAction(expenseReport?.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID, adminAccountID);
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, isSubmitAndClosePolicy ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.SUBMITTED);
const approvalChain = ReportUtils.getApprovalChain(policy, expenseReport);
const managerID = PersonalDetailsUtils.getAccountIDsByLogins(approvalChain).at(0);

const optimisticData: OnyxUpdate[] = !isSubmitAndClosePolicy
? [
Expand All @@ -7410,6 +7412,7 @@ function submitReport(expenseReport: OnyxTypes.Report) {
key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`,
value: {
...expenseReport,
managerID,
lastMessageText: ReportActionsUtils.getReportActionText(optimisticSubmittedReportAction),
lastMessageHtml: ReportActionsUtils.getReportActionHtml(optimisticSubmittedReportAction),
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
Expand Down

0 comments on commit 25bd09c

Please sign in to comment.