Skip to content

Commit

Permalink
fix: Header - Approve button appears briefly when it shouldn't
Browse files Browse the repository at this point in the history
  • Loading branch information
daledah committed Nov 25, 2024
1 parent f4f8da7 commit 7a4cb93
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 @@ -7190,6 +7190,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(PolicyUtils.getPolicy(expenseReport?.policyID), expenseReport);
const managerID = approvalChain.at(0);

const optimisticData: OnyxUpdate[] = !isSubmitAndClosePolicy

Check failure on line 7196 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / typecheck

Type '({ onyxMethod: "merge"; key: `reportActions_${string}`; value: { [x: string]: { pendingAction: "add"; reportActionID: string; sequenceNumber?: number | undefined; actionName: "ACTIONABLEADDPAYMENTCARD" | "ACTIONABLEJOINREQUEST" | ... 135 more ... | "UPDATEROOMDESCRIPTION"; ... 45 more ...; previousMessage?: (Message...' is not assignable to type 'OnyxUpdate[]'.
? [
Expand All @@ -7208,6 +7210,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 7a4cb93

Please sign in to comment.