From 8f77bd02ae59514c4675b2ee33312f0730b85b68 Mon Sep 17 00:00:00 2001 From: MobileMage Date: Tue, 10 Feb 2026 16:05:40 +0100 Subject: [PATCH] Fix next step showing 'an admin' instead of 'you' after approval Revert the effectiveNextStep logic from #80715 that incorrectly preferred the server's nextStep over the optimistic one after approval, causing the status bar to show "Waiting for an admin to pay" instead of "Waiting for you to pay". Fixes #81967 --- src/components/MoneyReportHeader.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 416af8b9b38a1..8b2f95a1c5f8c 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -539,10 +539,6 @@ function MoneyReportHeader({ optimisticNextStep = buildOptimisticNextStepForStrictPolicyRuleViolations(); } - // Check if we have a local optimistic override (e.g., error states, offline submission) - // When there's an override, we should NOT use the new translated format as the override takes precedence - const hasOptimisticOverride = optimisticNextStep !== nextStep; - const shouldShowNextStep = isFromPaidPolicy && !isInvoiceReport && !shouldShowStatusBar; const {nonHeldAmount, fullAmount, hasValidNonHeldAmount} = getNonHeldAndFullAmount(moneyRequestReport, shouldShowPayButton); const isAnyTransactionOnHold = hasHeldExpensesReportUtils(moneyRequestReport?.reportID); @@ -1752,14 +1748,8 @@ function MoneyReportHeader({ betas, }); - const effectiveNextStep = hasOptimisticOverride ? optimisticNextStep : (moneyRequestReport?.nextStep ?? optimisticNextStep); - const hasNextStepContent = !!( - effectiveNextStep && - (('message' in effectiveNextStep && Array.isArray(effectiveNextStep.message) && effectiveNextStep.message.length > 0) || - ('messageKey' in effectiveNextStep && effectiveNextStep.messageKey)) - ); - const showNextStepBar = shouldShowNextStep && hasNextStepContent; - const showNextStepSkeleton = shouldShowNextStep && !effectiveNextStep && !!isLoadingInitialReportActions && !isOffline; + const showNextStepBar = shouldShowNextStep && !!(optimisticNextStep?.message?.length ?? (optimisticNextStep && 'messageKey' in optimisticNextStep)); + const showNextStepSkeleton = shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline; const shouldShowMoreContent = showNextStepBar || showNextStepSkeleton || !!statusBarProps || isReportInSearch; return ( @@ -1836,7 +1826,7 @@ function MoneyReportHeader({ {shouldShowMoreContent && ( - {showNextStepBar && } + {showNextStepBar && } {showNextStepSkeleton && } {!!statusBarProps && (