Skip to content

Commit 97fb6e5

Browse files
committed
fix: don't show DEW approve error next step for auto-approval failures
Restore the automaticAction check removed in Expensify#79165 so auto-approval blocks keep the normal workflow next step while manual approval failures still show the error banner to the current approver.
1 parent c47687f commit 97fb6e5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/hooks/useOptimisticNextStep.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
getReportNextStep,
88
} from '@libs/NextStepUtils';
99
import {hasDynamicExternalWorkflow} from '@libs/PolicyUtils';
10-
import {getFilteredReportActionsForReportView, hasPendingDEWApprove, hasPendingDEWSubmit} from '@libs/ReportActionsUtils';
10+
import {getFilteredReportActionsForReportView, getOriginalMessage, hasPendingDEWApprove, hasPendingDEWSubmit} from '@libs/ReportActionsUtils';
1111
import {
1212
getAllReportActionsErrorsAndReportActionThatRequiresAttention,
1313
getReasonAndReportActionThatRequiresAttention,
@@ -93,7 +93,10 @@ function useOptimisticNextStep(reportID: string | undefined) {
9393
const hasDEWApproveFailed = gbrResult?.reason === CONST.REQUIRES_ATTENTION_REASONS.HAS_DEW_APPROVE_FAILED;
9494
const isCurrentUserTheApprover = moneyRequestReport?.managerID === accountID;
9595
if (hasDEWApproveFailed && isCurrentUserTheApprover) {
96-
optimisticNextStep = buildOptimisticNextStepForDynamicExternalWorkflowApproveError(theme.danger);
96+
const {automaticAction} = getOriginalMessage(gbrResult?.reportAction) ?? {};
97+
if (!automaticAction) {
98+
optimisticNextStep = buildOptimisticNextStepForDynamicExternalWorkflowApproveError(theme.danger);
99+
}
97100
} else if (isOffline && hasPendingDEWApprove(reportMetadata, isDEWPolicy)) {
98101
optimisticNextStep = buildOptimisticNextStepForDEWOffline();
99102
}

0 commit comments

Comments
 (0)