Skip to content

Commit 25bd09c

Browse files
authored
Merge pull request #53051 from daledah/fix/52669
fix: Header - Approve button appears briefly when it shouldn't
2 parents 08d8072 + 0537b11 commit 25bd09c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libs/actions/IOU.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7392,6 +7392,8 @@ function submitReport(expenseReport: OnyxTypes.Report) {
73927392
const adminAccountID = policy?.role === CONST.POLICY.ROLE.ADMIN ? currentUserPersonalDetails?.accountID : undefined;
73937393
const optimisticSubmittedReportAction = ReportUtils.buildOptimisticSubmittedReportAction(expenseReport?.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID, adminAccountID);
73947394
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, isSubmitAndClosePolicy ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.SUBMITTED);
7395+
const approvalChain = ReportUtils.getApprovalChain(policy, expenseReport);
7396+
const managerID = PersonalDetailsUtils.getAccountIDsByLogins(approvalChain).at(0);
73957397

73967398
const optimisticData: OnyxUpdate[] = !isSubmitAndClosePolicy
73977399
? [
@@ -7410,6 +7412,7 @@ function submitReport(expenseReport: OnyxTypes.Report) {
74107412
key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`,
74117413
value: {
74127414
...expenseReport,
7415+
managerID,
74137416
lastMessageText: ReportActionsUtils.getReportActionText(optimisticSubmittedReportAction),
74147417
lastMessageHtml: ReportActionsUtils.getReportActionHtml(optimisticSubmittedReportAction),
74157418
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,

0 commit comments

Comments
 (0)