You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-09-17] Add BA"Validate your bank account" is not opened instantly after clicking pending BA #99998
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorInternalRequires API changes or must be handled by Expensify staff
This is a regression of #93564. That issue was fixed by #94707 on 2026-07-10, and the fix was reverted five days later by #96182 because it caused deploy blocker #96130 ("Wallet - Blank RHP is shown after adding a Bank Account"). It was never re-landed.
What is the root cause of that problem?
The code that is supposed to skip the "Continue setup / Start over" screen for a pending USD bank account is dead code. It sets a state variable that nothing renders any more.
ReimbursementAccountPage.tsx:361-367 still says "If USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step", but none of its three statements does that today:
setUSDBankAccountStep(VALIDATION) — USDBankAccountStep is now write-only. No render path reads it; the only read in the file is a self-comparison at line 371.
goToWithdrawalAccountSetupStep(VALIDATION) — despite the name it performs no navigation. It is a single Onyx.merge of achData.currentStep (navigation.ts:13-15).
setShouldShowContinueSetupButton(...) sets the flag to true, because hasInProgressUSDVBBA returns true for every state that is not OPEN or LOCKED — including PENDING.
Execution then falls through to the page's terminal render at line 653, which passes shouldShowContinueSetupButton = true into VerifiedBankAccountFlowEntryPoint.tsx:285 — the "Continue setup / Start over" screen the tester saw.
The branch broke in #86645 ([CBN] USD flow refactor, commit 3dc75a95), which moved the USD flow onto its own route and deleted the render branch that consumed USDBankAccountStep, but left this call site behind. No type error, no lint error — the behaviour just silently stopped.
Supporting evidence and history
The Workflows entry point is not at fault.WorkflowsPaymentsTab.tsx:206-209 calls navigateToBankAccountRoute({policyID, backTo}) — byte-identical to the "Add bank account" call at line 358. No entry point in the app passes a param that opens the validate step directly, and nothing on the stepToOpen path clears shouldShowContinueSetupButton.
The state is PENDING, not VALIDATING.CONST.BANK_ACCOUNT.STATE.VALIDATING is declared but never referenced anywhere in src/. The "Validate your bank account" title and micro-deposit form are gated on PENDING in ConnectBankAccount.tsx.
Reverted#94707 over deploy blocker #96130. Never re-landed.
Why the previous fix caused #96130 (inferred, not runtime-verified). To make the validation page work when reached directly, #94707 also re-sourced state from BANK_ACCOUNT_LIST instead of achData. When policyID was absent or the list had not refreshed, bankAccountState became '', so neither the pending nor the verifying branch matched and the RHP rendered header-only — blank. It needed that change because only ReimbursementAccountPage calls openReimbursementAccountPage; bypassing that page leaves achData empty.
What changes do you think we should make in order to solve the problem?
Replace the three no-op statements in ReimbursementAccountPage.tsx:361-367 with a real redirect to ROUTES.BANK_ACCOUNT_USD_SETUP at page VALIDATION, performed from inside ReimbursementAccountPage after its fetch completes rather than at the caller.
Doing the redirect in-page is what avoids repeating #96130: openReimbursementAccountPage still runs, so achData.state is populated and ConnectBankAccount can keep reading it. No changes to ConnectBankAccount.tsx or BankAccountValidationForm.tsx are needed.
Three details the implementer must handle:
Gate on hasLoadedData and on not being in the change-bank-account flow, so the redirect fires only once real achData has arrived.
Latch it with a useRef. The back handler in USDVerifiedBankAccountFlowPage.tsx sends VALIDATION+PENDING back-presses to BANK_ACCOUNT_WITH_STEP_TO_OPEN, so an unlatched effect would bounce the user straight back into validate.
Use forceReplace so the interstitial stays out of the back stack. Both screens are siblings in the same RHP navigator, so Back lands on Workflows as expected.
What alternative solutions did you explore? (Optional)
Navigate straight to BANK_ACCOUNT_USD_SETUP?page=validation from WorkflowsPaymentsTab. Rejected — this is essentially what Open validation RHP directly for pending USD bank accounts #94707 did. USDVerifiedBankAccountFlowPage does no fetching of its own, so bypassing ReimbursementAccountPage leaves achData empty and reproduces the blank-RHP deploy blocker.
Make hasInProgressUSDVBBA return false for PENDING. Rejected — hasInProgressVBBA also gates shouldShowContinueModal and the "connect existing account" branches in WorkflowsPaymentsTab, so this would change unrelated behaviour.
I tried to reproduce this on web and was blocked before reaching the bank form. Clicking Connect manually immediately presented a "Validate your account" screen asking for a 6-digit security code emailed to the test account, which the automated tester cannot retrieve.
Complete manual bank account flow to final Continue
fail
Blocked by an email magic-code "Validate your account" gate before any routing/account number fields appeared.
"Validate your bank account" page displayed
fail
Never reached.
Pending bank account row opens validate instantly
fail
Not attempted — no bank account was created.
The analysis above therefore rests on code and git history, not a live repro. The defect is deterministic client-side render logic, and #93564 documents the identical user-visible behaviour, so confidence remains high.
Validate your account screen (6-digit email code) blocking the manual bank account connect flow
This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:
Rule:CONSISTENCY-19 — Never leave state that is written but never read
Condition: Flag a useState value whose getter is never read by a render path or by any logic other than a guard around its own setter — especially when a PR deletes a component usage or render branch and leaves the corresponding setX(...) calls behind. Either delete the state and its writes, or restore a reader.
Why: The write silently no-ops, so a behavioural branch becomes dead code with no type or lint error. Here it turned "skip the Continue setup step for pending USD bank accounts" into a permanent regression that shipped twice.
Search pattern: for each const [X, setX] = useState( in a changed file, count references to X excluding the declaration and setX; flag when the only remaining reference is a condition that guards a setX call.
Fix (✅): replace the dead writes with a real Navigation.navigate to the validation page, as described above.
This is distinct from CONSISTENCY-4 (No unused props), which covers props rather than component state. The full rule file, with the ❌/✅ code inline in App's coding-standards format, would go in Expensify/App itself. If it's worth adding, a maintainer can open it there as a draft PR.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99998) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
@MelvinBot Thanks, the root cause analysis holds up. I verified every claim against the tree before acting on it: USDBankAccountStep really is write-only, goToWithdrawalAccountSetupStep really is just an Onyx.merge, and hasInProgressUSDVBBA really does return true for PENDING. That part is solid, and it is why I implemented this locally rather than sending it back on paper.
I then ran the proposed solution end to end against a pending USD account. It does not work as written. Two of the failures are the exact things the proposal claims to avoid, and one of them is #96130 reproduced. Please update the proposal to cover the following:
⚠️ Issues with the initial proposal
🔴 forceReplace reproduces #96130.forceReplace sets the action to REPLACE (linkTo/index.ts:197-199), which pops ReimbursementAccountPage and unmounts it. Its own unmount cleanup (ReimbursementAccountPage.tsx:192-199) calls clearReimbursementAccount(), which is Onyx.set(ONYXKEYS.REIMBURSEMENT_ACCOUNT, CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA). DEFAULT_DATA.achData is {state: 'SETUP'} with no bankAccountID, so ConnectBankAccount matches none of its render branches and shows a header-only blank RHP titled "Add bank account". The proposal's reasoning accounts for the fetch but not the teardown: the page fetches the data and then, by replacing itself, destroys it. This must be a push.
🔴 An effect-only redirect cannot satisfy the expected result. Effects run after paint, so the entry point renders with shouldShowContinueSetupButton true for at least one frame before the navigation lands. The observed sequence was loading, then "Continue setup / Start over", then validate. That middle screen is precisely the issue's Actual Result, so the bug is not fixed, only made faster. The condition has to be derived during render and used to short-circuit the render as well, returning ReimbursementAccountLoadingIndicator instead of VerifiedBankAccountFlowEntryPoint.
🔴 The page's own teardown is hostile to any handoff, not just to forceReplace. Even with a push, on a cold load (browser refresh, then re-enter from Workflows) this page can unmount after the redirect has already dispatched, and the same clearReimbursementAccount() wipes the data out from under ConnectBankAccount. Same blank RHP, different trigger. The cleanup has to skip the wipe when the instance is unmounting only because it redirected into the validation step of the same flow. This is the part that most undermines the proposal's central claim: redirecting in-page does not by itself avoid #96130.
🟠 The fix does not fit in one file. Once this page reliably redirects a pending account, USDVerifiedBankAccountFlowPage.tsx:136-137 becomes a loop: it sends a VALIDATION plus PENDING back press to BANK_ACCOUNT_WITH_STEP_TO_OPEN, which is this page, which redirects again. It has to leave the flow instead, using backTo with a Navigation.dismissModal() fallback for entry points where backTo is absent, since Navigation.goBack(undefined) would pop straight back onto the redirector. Worth noting this is not a new contract: goBack in ReimbursementAccountPage.tsx:602-606 already calls Navigation.closeRHPFlow() for STEP.VALIDATION with STATE.PENDING. The change makes the USD flow page agree with what this file already does.
🟠 The useRef latch has to be split in two. A single latch cannot tell "the redirect is in flight and we are still on top" from "the user has navigated back onto us", because it flips synchronously while the page is still focused. The browser back button is not covered by the back handler above, and it exposed this: the render guard stayed true while the once-per-mount latch blocked any further navigation, so the page sat on the loading indicator forever. A second ref recording whether the page has actually been blurred is needed, plus an effect declared after the redirect effect so it does not race the navigation it follows.
🟡 Guard on policyID.REIMBURSEMENT_ACCOUNT is persisted, so on a cold load achData can still describe a different policy's account. hasInProgressVBBA already guards this (ReimbursementAccountUtils.ts:38-40) and so does the isPreviousPolicy check on the effect, but a render-derived condition needs it too. This becomes load-bearing once the cleanup skip keeps stale data around longer.
🟡 CONST.BANK_ACCOUNT.STEP.VALIDATION is not the route page name.STEP.VALIDATION is 'ValidationStep' but PAGE_NAMES.VALIDATION is 'validation'. The dead code being replaced uses the STEP constant, so "at page VALIDATION" leads an implementer to build bank-account/new/us/ValidationStep, which matches no page entry and silently falls back to index 0, the Country page. Use CONST.BANK_ACCOUNT.PAGE_NAMES.VALIDATION, and forward backTo, which the proposal also drops.
🟡 Please address the existing stepToOpen mechanism explicitly.getStepToOpenFromRouteParams already maps VALIDATE: 'validate' to CONST.BANK_ACCOUNT.STEP.VALIDATION, and ConnectExistingBusinessBankAccountPage.tsx:70 shows the idiomatic way to pass it via appendParam. I checked and it does not solve this, because since #86645 this page has no inline step rendering left and only renders VerifiedBankAccountFlowEntryPoint, so a navigation is still required. But a proposal bypassing existing infrastructure should say why.
One smaller note: removing goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.VALIDATION) also removes a real Onyx.merge of achData.currentStep that other code reads, including the stepToPageName map in continueUSDVBBASetup at line 501 and the goBack switch. It tested fine, but please describe it as a behaviour change rather than listing all three statements as pure no-ops.
Working diff, verified locally against a pending USD account
Tested on web. Entry from Workflows opens the validation step with no interstitial frame; in-app back and browser back both return to Workflows; the cold-load path (refresh on another tab, then re-enter from Workflows) no longer blanks; and non-pending accounts (VERIFYING, OPEN, fresh setup, non-USD, change bank account) are unaffected. Typechecks clean.
Not verified locally: the actual micro-deposit submit. My repro forces the client state, so ValidateBankAccountWithTransactions 404s against an account the backend does not consider pending.
The diff does not touch BankAccountValidationForm or validateBankAccount, and the bankAccountID sent is unchanged, but that round trip needs a genuinely pending account and should be an explicit acceptance criterion.
diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx--- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx+++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx@@ -121,6 +121,12 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
const hasClearedStalePlaidErrorsRef = useRef(false);
const isChangingBankAccountRef = useRef(isChangingBankAccount);
const hasShownConnectedBankAccountRef = useRef(false);
+ // Latches the pending-USD redirect below so the effect dispatches the navigation at most once per mount, even+ // though its dependencies change again while the transition is in flight.+ const hasRedirectedToPendingValidationRef = useRef(false);+ // Set once this page has actually been covered by the validation step. The redirect ref alone cannot tell that+ // apart from the redirect still being in flight, because it flips while this page is still focused.+ const hasBlurredAfterPendingRedirectRef = useRef(false);
const prevReimbursementAccount = usePrevious(reimbursementAccount);
const prevIsOffline = usePrevious(isOffline);
const achData = reimbursementAccount?.achData;
@@ -184,7 +190,10 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
useEffect(() => {
const isChangingBankAccountInstance = isChangingBankAccountRef.current;
return () => {
- if (!isChangingBankAccountInstance) {+ // Don't wipe the account when this instance unmounts only because it redirected into the validation step of+ // the same flow. ConnectBankAccount reads achData.state and does no fetching, so clearing here resets it to+ // DEFAULT_DATA underneath it and renders a blank header-only RHP (Expensify/App#96130).+ if (!isChangingBankAccountInstance && !hasRedirectedToPendingValidationRef.current) {
clearReimbursementAccountDraft();
clearReimbursementAccount();
}
@@ -228,6 +237,15 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
const isDefaultReimbursementAccountData = deepEqual(reimbursementAccount, CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA);
const hasLoadedData = reimbursementAccount?.achData && !isDefaultReimbursementAccountData && !reimbursementAccount?.isLoading;
+ // For a pending USD account this page only redirects, so it must never paint the entry point. Derived during render+ // because effects run after paint. Not latched on the redirect ref: that flips mid-transition and the next render+ // would fall through to the entry point. policyID is matched because REIMBURSEMENT_ACCOUNT is persisted.+ const shouldRedirectToPendingValidation =+ policyCurrency === CONST.CURRENCY.USD &&+ achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING &&+ !!hasLoadedData &&+ !isChangingBankAccount &&+ (!policyIDParam || achData?.policyID === policyIDParam);
/**
When this page is first opened, `reimbursementAccount` prop might not yet be fully loaded from Onyx.
Calculating `shouldShowContinueSetupButton` immediately on initial render doesn't make sense as
@@ -358,11 +376,13 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
return;
}
- // If USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step- if (policyCurrency === CONST.CURRENCY.USD && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) {- setUSDBankAccountStep(CONST.BANK_ACCOUNT.STEP.VALIDATION);- goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.VALIDATION);- setShouldShowContinueSetupButton(shouldShowContinueSetupButtonValue);+ // Navigate straight to the validation step and skip the Continue step. Done from inside this page so that+ // openReimbursementAccountPage has already populated the achData that ConnectBankAccount reads.+ if (shouldRedirectToPendingValidation && !hasRedirectedToPendingValidationRef.current) {+ hasRedirectedToPendingValidationRef.current = true;+ // A push, not a forceReplace: replacing unmounts this page and its cleanup wipes REIMBURSEMENT_ACCOUNT,+ // leaving ConnectBankAccount with state 'SETUP' and a blank RHP.+ Navigation.navigate(ROUTES.BANK_ACCOUNT_USD_SETUP.getRoute({policyID: policyIDParam, page: CONST.BANK_ACCOUNT.PAGE_NAMES.VALIDATION, backTo}));
return;
}
@@ -378,7 +398,44 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
// achData changes — not to local USDBankAccountStep updates — otherwise it races with prepareNextStep
// and briefly pulls USDBankAccountStep back to the server value before the Onyx merge lands.
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [policyIDParam, achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDSetup, isPreviousPolicy, achData?.state, policyCurrency]);+ }, [+ policyIDParam,+ achData?.currentStep,+ shouldShowContinueSetupButtonValue,+ isNonUSDSetup,+ isPreviousPolicy,+ achData?.state,+ policyCurrency,+ hasLoadedData,+ isChangingBankAccount,+ shouldRedirectToPendingValidation,+ backTo,+ ]);++ // Declared after the redirect effect so that on the commit where the redirect fires this runs with the blur flag+ // still unset and bails out, rather than racing the navigation it is meant to follow.+ useEffect(() => {+ if (!hasRedirectedToPendingValidationRef.current) {+ return;+ }++ if (!isFocused) {+ hasBlurredAfterPendingRedirectRef.current = true;+ return;+ }++ // The user navigated back onto this page, which the back handler cannot intercept for browser back. This page+ // only redirects for a pending account, so it would otherwise sit on the loader forever. Leave the flow.+ if (!hasBlurredAfterPendingRedirectRef.current || !shouldRedirectToPendingValidation) {+ return;+ }++ if (backTo) {+ Navigation.goBack(backTo);+ } else {+ Navigation.dismissModal();+ }+ }, [isFocused, shouldRedirectToPendingValidation, backTo]);
useEffect(() => {
if (!prevPolicyCurrency || policyCurrency === prevPolicyCurrency) {
@@ -648,6 +705,12 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
);
}
+ // Keep the loader on screen for a pending USD account so the "Continue setup / Start over" entry point is never+ // painted on the way to the validation step.+ if (shouldRedirectToPendingValidation) {+ return <ReimbursementAccountLoadingIndicator onBackButtonPress={goBack} />;+ }+
// Once fresh data has loaded, trust the live value to avoid a one-frame flash from the effect-synced state lagging achData.
// On a "change bank account" instance never show "continue setup", since the shared data still describes the account being replaced.
const shouldShowContinueSetupButtonToDisplay = !isChangingBankAccount && (hasLoadedData ? shouldShowContinueSetupButtonValue : shouldShowContinueSetupButton);
diff --git a/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage.tsx b/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage.tsx--- a/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage.tsx+++ b/src/pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage.tsx@@ -132,9 +132,14 @@ function USDVerifiedBankAccountFlowPage({route}: USDVerifiedBankAccountFlowPageP
const onBackButtonPress = useCallback(() => {
// When the bank account is pending validation it has already been submitted, so stepping back through the
- // setup pages doesn't make sense. Pop back to the entry point screen the user came from.+ // setup pages doesn't make sense. Leave the flow entirely rather than popping to ReimbursementAccountPage:+ // that page redirects a pending account straight back here, so returning to it would trap the user in a loop.
if (currentEntry?.pageName === PAGE_NAMES.VALIDATION && reimbursementAccount?.achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) {
- Navigation.goBack(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID, backTo}));+ if (backTo) {+ Navigation.goBack(backTo);+ } else {+ Navigation.dismissModal();+ }
return;
}
Accepted — all seven points and the smaller note are correct. I re-verified each one against 83cfe79 before rewriting, and I've corrected two line references in your list along the way. Three things in the working diff still need changing; the rest of it is what the updated proposal now specifies.
What still needs changing in the diff
1. (!policyIDParam || achData?.policyID === policyIDParam) is a pass-through, not a guard — and it becomes exploitable because of the cleanup skip.
Two shipping entry points mount this page with no policyID:
WalletPage/index.tsx:243 — navigateToBankAccountRoute({bankAccountID, backTo}), no policyID, and nothing clears achData first.
CountrySelection.tsx:75 — neither param. It does call clearReimbursementAccount() at line 72 first, but that's an async Onyx.set.
On both, !policyIDParam short-circuits the guard to true on first render. Combined with the cleanup skip (see point 3), a disk-persisted PENDINGachData from a different policy satisfies it and fires the redirect at the wrong account — and BANK_ACCOUNT_USD_SETUP.getRoute silently drops an undefined policyID, so the validation page has nothing to correct itself with. Require the param instead:
The bug only reproduces from a workspace entry point, so scoping the redirect to those loses nothing.
2. The new loader must not reuse goBack as its back handler.
goBack switches on currentStep, and only the ValidationStep + PENDING case leaves the flow. If the server returns ACHContractStep alongside PENDING, back hits line 522, which is a bare goToWithdrawalAccountSetupStep(BENEFICIAL_OWNERS) — an Onyx.merge with no navigation. The user stays on the loader and their step is walked backwards. The CountryStep fallback at line 494 is the same dead end, reachable whenever achData.accountNumber is empty. Your diff removes the goToWithdrawalAccountSetupStep(VALIDATION) that used to force the step, so this is no longer self-correcting.
Use it in the escape effect and in USDVerifiedBankAccountFlowPage too, so there's one definition of "leave this flow" rather than three copies. Keep it a plain function, not a useCallback — this file compiles under React Compiler.
3. Nothing else ever resets REIMBURSEMENT_ACCOUNT, so the cleanup skip is permanent.
clearReimbursementAccount() has exactly three callers: the cleanup you're skipping, CountrySelection.tsx:72, and prepareNewBankAccountSetup — whose in-flow call site is VerifiedBankAccountFlowEntryPoint.tsx:134, the exact component your render guard stops rendering. Neither USDVerifiedBankAccountFlowPage nor ConnectBankAccount clears on unmount. openReimbursementAccountPage overwrites rather than resets, and its optimistic data only touches isLoading. The key is persisted, so a stale PENDINGachData survives to disk until sign-out.
That's acceptable — but it's the mechanism behind point 1, so tightening the guard isn't optional, and "stale achData outlives the flow" belongs in the acceptance criteria.
continueUSDVBBASetup's stepToPageName map is at lines 463-477, not line 501.
And a confirmation that supports your framing: closeRHPFlow() and dismissModal() are equivalent for this screen pair. Both ReimbursementAccountPage and USDVerifiedBankAccountFlowPage are registered in SettingsModalStackNavigator, so the RHP navigator has a single child; closeRHPFlow finds routes.length === 1, targets the root, and pops the whole modal. Your dismissModal() does the same thing. Neither honours backTo, which is why the backTo-first ordering in your handler matters.
Updated proposal follows.
Proposal
This is a regression of #93564. That issue was fixed by #94707 on 2026-07-10 and reverted five days later by #96182 because it caused deploy blocker #96130. It was never re-landed.
What is the root cause of that problem?
Unchanged from the original proposal, and independently re-verified at 83cfe79. The block at ReimbursementAccountPage.tsx:361-367 claims to skip the "Continue setup / Start over" screen for a pending USD account, but does not:
setUSDBankAccountStep(VALIDATION) — USDBankAccountStep is write-only; no render path reads it.
goToWithdrawalAccountSetupStep(VALIDATION) — navigation.ts:13-15 is an Onyx.merge of achData.currentStep, not a navigation.
setShouldShowContinueSetupButton(...) sets the flag to true, because hasInProgressUSDVBBA returns true for every state other than OPEN and LOCKED, including PENDING.
Execution falls through to line 653, which renders VerifiedBankAccountFlowEntryPoint with shouldShowContinueSetupButton = true — the screen the tester saw. The branch broke in #86645, which deleted the render branch consuming USDBankAccountStep and left the call site behind.
Correction to the original proposal: statement 2 is not a no-op. It is a real Onyx.merge whose value is read by continueUSDVBBASetup's stepToPageName map, by the goBack switch, and by the route-sync effect at line 425. Removing it is a behaviour change: achData.currentStep will hold whatever the server returned instead of being forced to ValidationStep. That is what makes fix 2 above necessary.
What changes do you think we should make in order to solve the problem?
Two files. ikevin127's diff above, with the three amendments in fix 1-3.
ReimbursementAccountPage.tsx
Derive the condition during render, not in an effect. Effects run after paint, so an effect-only redirect still paints "Continue setup / Start over" for a frame — the issue's Actual Result, just faster. Add a plain derived const next to hasLoadedData: USD currency, achData.state === PENDING, hasLoadedData, not isChangingBankAccount, and !!policyIDParam && achData?.policyID === policyIDParam. Not useMemo — this file compiles under React Compiler.
Short-circuit the render with it, returning ReimbursementAccountLoadingIndicator instead of VerifiedBankAccountFlowEntryPoint, placed after the existing loader at line 569. Give it the leave-the-flow handler, not goBack.
Redirect with a push, replacing the three statements at 361-367 with Navigation.navigate(ROUTES.BANK_ACCOUNT_USD_SETUP.getRoute({policyID: policyIDParam, page: CONST.BANK_ACCOUNT.PAGE_NAMES.VALIDATION, backTo})). PAGE_NAMES.VALIDATION ('validation'), not STEP.VALIDATION ('ValidationStep') — an unmatched page name falls through findIndex to index 0, the Country page. Forward backTo.
Not forceReplace.linkTo/index.ts:197-198 turns it into REPLACE, which unmounts this page and runs the cleanup that wipes the data the destination needs. See below.
Skip the unmount wipe when the instance is unmounting because it redirected. The cleanup at lines 184-194 calls clearReimbursementAccount(), which Onyx.sets the key to DEFAULT_DATA (achData: {state: 'SETUP'}). ConnectBankAccount branches purely on achData.state and fetches nothing, so SETUP matches no branch and it renders a header-only RHP titled "Add bank account" — [$250] Wallet - Blank RHP is shown after adding a Bank Account #96130 exactly. This bites on cold load even with a push.
Two refs, not one. The redirect latch flips synchronously while the page is still focused, so it can't distinguish "redirect in flight" from "user came back". Add a second ref recording an actual blur, plus an escape effect declared after the redirect effect so it doesn't race the navigation it follows. Without it, browser back leaves the page on the loader forever, since the back handler can't intercept it.
USDVerifiedBankAccountFlowPage.tsx
The VALIDATION + PENDING back handler must leave the flow.Lines 133-139 currently go back to BANK_ACCOUNT_WITH_STEP_TO_OPEN, which resolves to SCREENS.REIMBURSEMENT_ACCOUNT → ReimbursementAccountPage, which now redirects straight back. Use backTo with a Navigation.dismissModal() fallback; Navigation.goBack(undefined) would pop onto the redirector.
Why the existing stepToOpen mechanism doesn't solve this
It doesn't help here. ReimbursementAccountPage still consumes stepToOpen at lines 260, 344 and 424 — it isn't dead — but only to seed currentStep state, reset the sub-step, and sync the route. Since #86645 it selects no rendered step component; the only thing the page renders on this path is VerifiedBankAccountFlowEntryPoint. A navigation to the USD flow route is still required.
Acceptance criteria
Verified by ikevin127 locally against a pending USD account on web:
Entry from Workflows opens the validation step with no interstitial "Continue setup / Start over" frame.
In-app back and browser back both return to Workflows.
Cold load (refresh, then re-enter from Workflows) does not blank the RHP.
VERIFYING, OPEN, fresh setup, non-USD and change-bank-account are unaffected. Typechecks clean.
Still to verify:
The micro-deposit submit round trip.ValidateBankAccountWithTransactions needs a genuinely pending account; a forced client state 404s. The diff doesn't touch BankAccountValidationForm or validateBankAccount and the bankAccountID sent is unchanged, but this should be exercised for real.
Settings → Wallet → tap an existing bank account (WalletPage/index.tsx:243, no policyID) while a PENDINGachData for a different policy is on disk. Must not redirect. This is what fix 1 guards.
Back on the loading indicator while achData.currentStep is ACHContractStep rather than ValidationStep. Must leave the flow, not merge the step backwards. This is what fix 2 guards.
Stale achData outliving the flow, since the cleanup skip means nothing resets REIMBURSEMENT_ACCOUNT until sign-out.
What alternative solutions did you explore? (Optional)
An effect-only redirect with no render guard. Rejected — verified to still paint the interstitial for a frame.
Make hasInProgressUSDVBBA return false for PENDING. Rejected — hasInProgressVBBA also gates shouldShowContinueModal and the "connect existing account" branches in WorkflowsPaymentsTab.
Unchanged from the original proposal: CONSISTENCY-19 — flag useState whose getter is never read by a render path or by any logic other than a guard around its own setter, especially when a PR deletes a render branch and leaves the setX(...) calls behind. This bug is that pattern, and it shipped twice.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99998) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please mark it as "Ready for review" when it is ready for review.
It implements your working diff plus the three amendments from the approved proposal. Two files, +85/−9.
What landed
ReimbursementAccountPage.tsx — render-derived shouldRedirectToPendingValidation, a push (not forceReplace) to BANK_ACCOUNT_USD_SETUP at PAGE_NAMES.VALIDATION with backTo forwarded, the render short-circuit to ReimbursementAccountLoadingIndicator, the unmount-cleanup skip, and the two-ref latch with the escape effect declared after the redirect effect.
USDVerifiedBankAccountFlowPage.tsx — the VALIDATION + PENDING back press now leaves the flow via backTo with a Navigation.dismissModal() fallback, instead of returning to the page that redirects back into it.
The three amendments
The policy guard is !!policyIDParam && achData?.policyID === policyIDParam rather than (!policyIDParam || ...), so the WalletPage and BankAccountPurposePage entry points that pass no policyID can't satisfy it with another policy's persisted account.
The loader's back button gets a shared leavePendingValidationFlow handler, not goBack — goBack switches on currentStep and several cases only Onyx.merge with no navigation, which would strand the user on the loader.
That handler is the single definition of "leave this flow", reused by the escape effect.
One deviation from the proposal text, and the reason for it: I wrote leavePendingValidationFlow as a useCallback rather than a plain function. The compliance check shows ReimbursementAccountPage.tsx does not compile under React Compiler — it fails on both Babel and OXC with 3 × "Cannot access refs during render" on origin/main, before any of my changes. Since the file isn't compiled, the no-manual-memoization rule doesn't apply to it and the surrounding useCallback idiom does. It also lets the escape effect list a real dependency instead of a lint suppression.
Checks
typecheck, lint-changed, spell-changed and the storybook smoke test all pass. 18 bank-account and reimbursement suites pass (249 tests). The React Compiler check is byte-identical to the origin/main baseline — same 3 pre-existing errors, only the line number shifts as the existing code moved down — so no regression and no new memoization divergence; USDVerifiedBankAccountFlowPage.tsx passes both compilers before and after.
Two things I did not do, stated plainly rather than left implied. The full Jest suite exceeded the local time budget, so CI is the first place it runs end to end; --findRelatedTests reports no test file covers either changed file directly, so the 18 suites above are the existing coverage. And I ran no manual verification — the PR carries no screenshots, and the Tests, Offline tests and QA Steps sections are left as TODOs for you, seeded with the suggested steps from the proposal's acceptance criteria. The micro-deposit submit against a genuinely pending account is the one that still needs a real backend round trip.
I added no unit tests. The change is navigation and render-gating in a screen with no existing test harness, so a meaningful test would mean building that harness — worth doing, but a larger change than this fix, and your call whether to fold it in.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorInternalRequires API changes or must be handled by Expensify staff
Activity
applause-bot commentedon Sep 1, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/5038325d9c63e035632fae7f8387fb04cd5f6c489af3f50ba44419b034e29a48
MelvinBot commentedon Sep 1, 2026
Proposal
What is the root cause of that problem?
The code that is supposed to skip the "Continue setup / Start over" screen for a pending USD bank account is dead code. It sets a state variable that nothing renders any more.
ReimbursementAccountPage.tsx:361-367still says "If USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step", but none of its three statements does that today:setUSDBankAccountStep(VALIDATION)—USDBankAccountStepis now write-only. No render path reads it; the only read in the file is a self-comparison at line 371.goToWithdrawalAccountSetupStep(VALIDATION)— despite the name it performs no navigation. It is a singleOnyx.mergeofachData.currentStep(navigation.ts:13-15).setShouldShowContinueSetupButton(...)sets the flag totrue, becausehasInProgressUSDVBBAreturns true for every state that is notOPENorLOCKED— includingPENDING.Execution then falls through to the page's terminal render at line 653, which passes
shouldShowContinueSetupButton = trueintoVerifiedBankAccountFlowEntryPoint.tsx:285— the "Continue setup / Start over" screen the tester saw.The branch broke in #86645 ([CBN] USD flow refactor, commit
3dc75a95), which moved the USD flow onto its own route and deleted the render branch that consumedUSDBankAccountStep, but left this call site behind. No type error, no lint error — the behaviour just silently stopped.Supporting evidence and history
The Workflows entry point is not at fault.
WorkflowsPaymentsTab.tsx:206-209callsnavigateToBankAccountRoute({policyID, backTo})— byte-identical to the "Add bank account" call at line 358. No entry point in the app passes a param that opens the validate step directly, and nothing on thestepToOpenpath clearsshouldShowContinueSetupButton.The state is
PENDING, notVALIDATING.CONST.BANK_ACCOUNT.STATE.VALIDATINGis declared but never referenced anywhere insrc/. The "Validate your bank account" title and micro-deposit form are gated onPENDINGinConnectBankAccount.tsx.Timeline
3dc75a95)USDBankAccountStepwas deleted. Branch became dead code.setShouldShowContinueSetupButtonline; its description explicitly accepted showing the interstitial.Why the previous fix caused #96130 (inferred, not runtime-verified). To make the validation page work when reached directly, #94707 also re-sourced state from
BANK_ACCOUNT_LISTinstead ofachData. WhenpolicyIDwas absent or the list had not refreshed,bankAccountStatebecame'', so neither the pending nor the verifying branch matched and the RHP rendered header-only — blank. It needed that change because onlyReimbursementAccountPagecallsopenReimbursementAccountPage; bypassing that page leavesachDataempty.What changes do you think we should make in order to solve the problem?
Replace the three no-op statements in
ReimbursementAccountPage.tsx:361-367with a real redirect toROUTES.BANK_ACCOUNT_USD_SETUPat pageVALIDATION, performed from insideReimbursementAccountPageafter its fetch completes rather than at the caller.Doing the redirect in-page is what avoids repeating #96130:
openReimbursementAccountPagestill runs, soachData.stateis populated andConnectBankAccountcan keep reading it. No changes toConnectBankAccount.tsxorBankAccountValidationForm.tsxare needed.Three details the implementer must handle:
hasLoadedDataand on not being in the change-bank-account flow, so the redirect fires only once realachDatahas arrived.useRef. The back handler inUSDVerifiedBankAccountFlowPage.tsxsends VALIDATION+PENDING back-presses toBANK_ACCOUNT_WITH_STEP_TO_OPEN, so an unlatched effect would bounce the user straight back into validate.forceReplaceso the interstitial stays out of the back stack. Both screens are siblings in the same RHP navigator, so Back lands on Workflows as expected.What alternative solutions did you explore? (Optional)
BANK_ACCOUNT_USD_SETUP?page=validationfromWorkflowsPaymentsTab. Rejected — this is essentially what Open validation RHP directly for pending USD bank accounts #94707 did.USDVerifiedBankAccountFlowPagedoes no fetching of its own, so bypassingReimbursementAccountPageleavesachDataempty and reproduces the blank-RHP deploy blocker.hasInProgressUSDVBBAreturnfalseforPENDING. Rejected —hasInProgressVBBAalso gatesshouldShowContinueModaland the "connect existing account" branches inWorkflowsPaymentsTab, so this would change unrelated behaviour.BANK_ACCOUNT_LIST-derived state changes are the part that broke.Reproduction attempt on web
I tried to reproduce this on web and was blocked before reaching the bank form. Clicking Connect manually immediately presented a "Validate your account" screen asking for a 6-digit security code emailed to the test account, which the automated tester cannot retrieve.
The analysis above therefore rests on code and git history, not a live repro. The defect is deterministic client-side render logic, and #93564 documents the identical user-visible behaviour, so confidence remains high.
Validate your account screen (6-digit email code) blocking the manual bank account connect flow
Related issues
💡 Suggested AI code review rule
This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for
Expensify/App:CONSISTENCY-19— Never leave state that is written but never readuseStatevalue whose getter is never read by a render path or by any logic other than a guard around its own setter — especially when a PR deletes a component usage or render branch and leaves the correspondingsetX(...)calls behind. Either delete the state and its writes, or restore a reader.const [X, setX] = useState(in a changed file, count references toXexcluding the declaration andsetX; flag when the only remaining reference is a condition that guards asetXcall.ReimbursementAccountPage.tsx:361-367Navigation.navigateto the validation page, as described above.This is distinct from
CONSISTENCY-4(No unused props), which covers props rather than component state. The full rule file, with the ❌/✅ code inline in App's coding-standards format, would go inExpensify/Appitself. If it's worth adding, a maintainer can open it there as a draft PR.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99998)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
j3ffffff commentedon Sep 1, 2026
melvin-bot commentedon Sep 1, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 (
External)melvin-bot commentedon Sep 1, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
ikevin127 commentedon Sep 2, 2026
@MelvinBot Thanks, the root cause analysis holds up. I verified every claim against the tree before acting on it:
USDBankAccountStepreally is write-only,goToWithdrawalAccountSetupStepreally is just anOnyx.merge, andhasInProgressUSDVBBAreally does returntrueforPENDING. That part is solid, and it is why I implemented this locally rather than sending it back on paper.I then ran the proposed solution end to end against a pending USD account. It does not work as written. Two of the failures are the exact things the proposal claims to avoid, and one of them is
#96130reproduced. Please update the proposal to cover the following:🔴
forceReplacereproduces #96130.forceReplacesets the action toREPLACE(linkTo/index.ts:197-199), which popsReimbursementAccountPageand unmounts it. Its own unmount cleanup (ReimbursementAccountPage.tsx:192-199) callsclearReimbursementAccount(), which isOnyx.set(ONYXKEYS.REIMBURSEMENT_ACCOUNT, CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA).DEFAULT_DATA.achDatais{state: 'SETUP'}with nobankAccountID, soConnectBankAccountmatches none of its render branches and shows a header-only blank RHP titled "Add bank account". The proposal's reasoning accounts for the fetch but not the teardown: the page fetches the data and then, by replacing itself, destroys it. This must be a push.🔴 An effect-only redirect cannot satisfy the expected result. Effects run after paint, so the entry point renders with
shouldShowContinueSetupButtontrue for at least one frame before the navigation lands. The observed sequence was loading, then "Continue setup / Start over", then validate. That middle screen is precisely the issue's Actual Result, so the bug is not fixed, only made faster. The condition has to be derived during render and used to short-circuit the render as well, returningReimbursementAccountLoadingIndicatorinstead ofVerifiedBankAccountFlowEntryPoint.🔴 The page's own teardown is hostile to any handoff, not just to
forceReplace. Even with a push, on a cold load (browser refresh, then re-enter from Workflows) this page can unmount after the redirect has already dispatched, and the sameclearReimbursementAccount()wipes the data out from underConnectBankAccount. Same blank RHP, different trigger. The cleanup has to skip the wipe when the instance is unmounting only because it redirected into the validation step of the same flow. This is the part that most undermines the proposal's central claim: redirecting in-page does not by itself avoid#96130.🟠 The fix does not fit in one file. Once this page reliably redirects a pending account,
USDVerifiedBankAccountFlowPage.tsx:136-137becomes a loop: it sends a VALIDATION plus PENDING back press toBANK_ACCOUNT_WITH_STEP_TO_OPEN, which is this page, which redirects again. It has to leave the flow instead, usingbackTowith aNavigation.dismissModal()fallback for entry points wherebackTois absent, sinceNavigation.goBack(undefined)would pop straight back onto the redirector. Worth noting this is not a new contract:goBackinReimbursementAccountPage.tsx:602-606already callsNavigation.closeRHPFlow()forSTEP.VALIDATIONwithSTATE.PENDING. The change makes the USD flow page agree with what this file already does.🟠 The
useReflatch has to be split in two. A single latch cannot tell "the redirect is in flight and we are still on top" from "the user has navigated back onto us", because it flips synchronously while the page is still focused. The browser back button is not covered by the back handler above, and it exposed this: the render guard stayed true while the once-per-mount latch blocked any further navigation, so the page sat on the loading indicator forever. A second ref recording whether the page has actually been blurred is needed, plus an effect declared after the redirect effect so it does not race the navigation it follows.🟡 Guard on
policyID.REIMBURSEMENT_ACCOUNTis persisted, so on a cold loadachDatacan still describe a different policy's account.hasInProgressVBBAalready guards this (ReimbursementAccountUtils.ts:38-40) and so does theisPreviousPolicycheck on the effect, but a render-derived condition needs it too. This becomes load-bearing once the cleanup skip keeps stale data around longer.🟡
CONST.BANK_ACCOUNT.STEP.VALIDATIONis not the route page name.STEP.VALIDATIONis'ValidationStep'butPAGE_NAMES.VALIDATIONis'validation'. The dead code being replaced uses theSTEPconstant, so "at pageVALIDATION" leads an implementer to buildbank-account/new/us/ValidationStep, which matches no page entry and silently falls back to index 0, the Country page. UseCONST.BANK_ACCOUNT.PAGE_NAMES.VALIDATION, and forwardbackTo, which the proposal also drops.🟡 Please address the existing
stepToOpenmechanism explicitly.getStepToOpenFromRouteParamsalready mapsVALIDATE: 'validate'toCONST.BANK_ACCOUNT.STEP.VALIDATION, andConnectExistingBusinessBankAccountPage.tsx:70shows the idiomatic way to pass it viaappendParam. I checked and it does not solve this, because since #86645 this page has no inline step rendering left and only rendersVerifiedBankAccountFlowEntryPoint, so a navigation is still required. But a proposal bypassing existing infrastructure should say why.One smaller note: removing
goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.VALIDATION)also removes a realOnyx.mergeofachData.currentStepthat other code reads, including thestepToPageNamemap incontinueUSDVBBASetupat line 501 and thegoBackswitch. It tested fine, but please describe it as a behaviour change rather than listing all three statements as pure no-ops.Working diff, verified locally against a pending USD account
Tested on web. Entry from Workflows opens the validation step with no interstitial frame; in-app back and browser back both return to Workflows; the cold-load path (refresh on another tab, then re-enter from Workflows) no longer blanks; and non-pending accounts (
VERIFYING,OPEN, fresh setup, non-USD, change bank account) are unaffected. Typechecks clean.Not verified locally: the actual micro-deposit submit. My repro forces the client state, so
ValidateBankAccountWithTransactions404s against an account the backend does not consider pending.The diff does not touch
BankAccountValidationFormorvalidateBankAccount, and thebankAccountIDsent is unchanged, but that round trip needs a genuinely pending account and should be an explicit acceptance criterion.MelvinBot commentedon Sep 2, 2026
Accepted — all seven points and the smaller note are correct. I re-verified each one against
83cfe79before rewriting, and I've corrected two line references in your list along the way. Three things in the working diff still need changing; the rest of it is what the updated proposal now specifies.What still needs changing in the diff
1.
(!policyIDParam || achData?.policyID === policyIDParam)is a pass-through, not a guard — and it becomes exploitable because of the cleanup skip.Two shipping entry points mount this page with no
policyID:WalletPage/index.tsx:243—navigateToBankAccountRoute({bankAccountID, backTo}), nopolicyID, and nothing clearsachDatafirst.CountrySelection.tsx:75— neither param. It does callclearReimbursementAccount()at line 72 first, but that's an asyncOnyx.set.On both,
!policyIDParamshort-circuits the guard totrueon first render. Combined with the cleanup skip (see point 3), a disk-persistedPENDINGachDatafrom a different policy satisfies it and fires the redirect at the wrong account — andBANK_ACCOUNT_USD_SETUP.getRoutesilently drops an undefinedpolicyID, so the validation page has nothing to correct itself with. Require the param instead:The bug only reproduces from a workspace entry point, so scoping the redirect to those loses nothing.
2. The new loader must not reuse
goBackas its back handler.goBackswitches oncurrentStep, and only theValidationStep+PENDINGcase leaves the flow. If the server returnsACHContractStepalongsidePENDING, back hits line 522, which is a baregoToWithdrawalAccountSetupStep(BENEFICIAL_OWNERS)— anOnyx.mergewith no navigation. The user stays on the loader and their step is walked backwards. TheCountryStepfallback at line 494 is the same dead end, reachable wheneverachData.accountNumberis empty. Your diff removes thegoToWithdrawalAccountSetupStep(VALIDATION)that used to force the step, so this is no longer self-correcting.Reuse the escape you already wrote:
Use it in the escape effect and in
USDVerifiedBankAccountFlowPagetoo, so there's one definition of "leave this flow" rather than three copies. Keep it a plain function, not auseCallback— this file compiles under React Compiler.3. Nothing else ever resets
REIMBURSEMENT_ACCOUNT, so the cleanup skip is permanent.clearReimbursementAccount()has exactly three callers: the cleanup you're skipping,CountrySelection.tsx:72, andprepareNewBankAccountSetup— whose in-flow call site isVerifiedBankAccountFlowEntryPoint.tsx:134, the exact component your render guard stops rendering. NeitherUSDVerifiedBankAccountFlowPagenorConnectBankAccountclears on unmount.openReimbursementAccountPageoverwrites rather than resets, and its optimistic data only touchesisLoading. The key is persisted, so a stalePENDINGachDatasurvives to disk until sign-out.That's acceptable — but it's the mechanism behind point 1, so tightening the guard isn't optional, and "stale
achDataoutlives the flow" belongs in the acceptance criteria.Two corrections to your references
closeRHPFlow()precedent is atReimbursementAccountPage.tsx:526-530, not 602-606.continueUSDVBBASetup'sstepToPageNamemap is at lines 463-477, not line 501.And a confirmation that supports your framing:
closeRHPFlow()anddismissModal()are equivalent for this screen pair. BothReimbursementAccountPageandUSDVerifiedBankAccountFlowPageare registered inSettingsModalStackNavigator, so the RHP navigator has a single child;closeRHPFlowfindsroutes.length === 1, targets the root, and pops the whole modal. YourdismissModal()does the same thing. Neither honoursbackTo, which is why thebackTo-first ordering in your handler matters.Updated proposal follows.
Proposal
What is the root cause of that problem?
Unchanged from the original proposal, and independently re-verified at
83cfe79. The block atReimbursementAccountPage.tsx:361-367claims to skip the "Continue setup / Start over" screen for a pending USD account, but does not:setUSDBankAccountStep(VALIDATION)—USDBankAccountStepis write-only; no render path reads it.goToWithdrawalAccountSetupStep(VALIDATION)—navigation.ts:13-15is anOnyx.mergeofachData.currentStep, not a navigation.setShouldShowContinueSetupButton(...)sets the flag totrue, becausehasInProgressUSDVBBAreturns true for every state other thanOPENandLOCKED, includingPENDING.Execution falls through to line 653, which renders
VerifiedBankAccountFlowEntryPointwithshouldShowContinueSetupButton = true— the screen the tester saw. The branch broke in #86645, which deleted the render branch consumingUSDBankAccountStepand left the call site behind.Correction to the original proposal: statement 2 is not a no-op. It is a real
Onyx.mergewhose value is read bycontinueUSDVBBASetup'sstepToPageNamemap, by thegoBackswitch, and by the route-sync effect at line 425. Removing it is a behaviour change:achData.currentStepwill hold whatever the server returned instead of being forced toValidationStep. That is what makes fix 2 above necessary.What changes do you think we should make in order to solve the problem?
Two files.
ikevin127's diff above, with the three amendments in fix 1-3.ReimbursementAccountPage.tsxhasLoadedData: USD currency,achData.state === PENDING,hasLoadedData, notisChangingBankAccount, and!!policyIDParam && achData?.policyID === policyIDParam. NotuseMemo— this file compiles under React Compiler.ReimbursementAccountLoadingIndicatorinstead ofVerifiedBankAccountFlowEntryPoint, placed after the existing loader at line 569. Give it the leave-the-flow handler, notgoBack.Navigation.navigate(ROUTES.BANK_ACCOUNT_USD_SETUP.getRoute({policyID: policyIDParam, page: CONST.BANK_ACCOUNT.PAGE_NAMES.VALIDATION, backTo})).PAGE_NAMES.VALIDATION('validation'), notSTEP.VALIDATION('ValidationStep') — an unmatched page name falls throughfindIndexto index 0, the Country page. ForwardbackTo.forceReplace.linkTo/index.ts:197-198turns it intoREPLACE, which unmounts this page and runs the cleanup that wipes the data the destination needs. See below.clearReimbursementAccount(), whichOnyx.sets the key toDEFAULT_DATA(achData: {state: 'SETUP'}).ConnectBankAccountbranches purely onachData.stateand fetches nothing, soSETUPmatches no branch and it renders a header-only RHP titled "Add bank account" — [$250] Wallet - Blank RHP is shown after adding a Bank Account #96130 exactly. This bites on cold load even with a push.USDVerifiedBankAccountFlowPage.tsxVALIDATION+PENDINGback handler must leave the flow. Lines 133-139 currently go back toBANK_ACCOUNT_WITH_STEP_TO_OPEN, which resolves toSCREENS.REIMBURSEMENT_ACCOUNT→ReimbursementAccountPage, which now redirects straight back. UsebackTowith aNavigation.dismissModal()fallback;Navigation.goBack(undefined)would pop onto the redirector.Why the existing
stepToOpenmechanism doesn't solve thisgetStepToOpenFromRouteParamsdoes mapVALIDATE: 'validate'→CONST.BANK_ACCOUNT.STEP.VALIDATION, andConnectExistingBusinessBankAccountPage.tsx:70is the idiomatic way to pass it viaappendParam.It doesn't help here.
ReimbursementAccountPagestill consumesstepToOpenat lines 260, 344 and 424 — it isn't dead — but only to seedcurrentStepstate, reset the sub-step, and sync the route. Since #86645 it selects no rendered step component; the only thing the page renders on this path isVerifiedBankAccountFlowEntryPoint. A navigation to the USD flow route is still required.Acceptance criteria
Verified by
ikevin127locally against a pending USD account on web:VERIFYING,OPEN, fresh setup, non-USD and change-bank-account are unaffected. Typechecks clean.Still to verify:
ValidateBankAccountWithTransactionsneeds a genuinely pending account; a forced client state 404s. The diff doesn't touchBankAccountValidationFormorvalidateBankAccountand thebankAccountIDsent is unchanged, but this should be exercised for real.WalletPage/index.tsx:243, nopolicyID) while aPENDINGachDatafor a different policy is on disk. Must not redirect. This is what fix 1 guards.achData.currentStepisACHContractSteprather thanValidationStep. Must leave the flow, not merge the step backwards. This is what fix 2 guards.achDataoutliving the flow, since the cleanup skip means nothing resetsREIMBURSEMENT_ACCOUNTuntil sign-out.What alternative solutions did you explore? (Optional)
BANK_ACCOUNT_USD_SETUP?page=validationfromWorkflowsPaymentsTab. Rejected — this is what Open validation RHP directly for pending USD bank accounts #94707 did.USDVerifiedBankAccountFlowPageandConnectBankAccountfetch nothing;openReimbursementAccountPageis only called fromReimbursementAccountPage, so bypassing it leavesachDataempty and reproduces [$250] Wallet - Blank RHP is shown after adding a Bank Account #96130.forceReplacefrom inside the page. Rejected — verified byikevin127to reproduce [$250] Wallet - Blank RHP is shown after adding a Bank Account #96130 for the same reason via a different route: the page fetches the data, then destroys it by replacing itself.hasInProgressUSDVBBAreturnfalseforPENDING. Rejected —hasInProgressVBBAalso gatesshouldShowContinueModaland the "connect existing account" branches inWorkflowsPaymentsTab.BANK_ACCOUNT_LIST-derived state changes are the part that broke.Related issues
💡 Suggested AI code review rule
Unchanged from the original proposal:
CONSISTENCY-19— flaguseStatewhose getter is never read by a render path or by any logic other than a guard around its own setter, especially when a PR deletes a render branch and leaves thesetX(...)calls behind. This bug is that pattern, and it shipped twice.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99998)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
ikevin127 commentedon Sep 2, 2026
@MelvinBot implement this to create a draft PR.
MelvinBot commentedon Sep 2, 2026
🤖 Draft PR created: #100113
Please mark it as "Ready for review" when it is ready for review.
It implements your working diff plus the three amendments from the approved proposal. Two files, +85/−9.
What landed
ReimbursementAccountPage.tsx— render-derivedshouldRedirectToPendingValidation, a push (notforceReplace) toBANK_ACCOUNT_USD_SETUPatPAGE_NAMES.VALIDATIONwithbackToforwarded, the render short-circuit toReimbursementAccountLoadingIndicator, the unmount-cleanup skip, and the two-ref latch with the escape effect declared after the redirect effect.USDVerifiedBankAccountFlowPage.tsx— theVALIDATION+PENDINGback press now leaves the flow viabackTowith aNavigation.dismissModal()fallback, instead of returning to the page that redirects back into it.The three amendments
!!policyIDParam && achData?.policyID === policyIDParamrather than(!policyIDParam || ...), so theWalletPageandBankAccountPurposePageentry points that pass nopolicyIDcan't satisfy it with another policy's persisted account.leavePendingValidationFlowhandler, notgoBack—goBackswitches oncurrentStepand several cases onlyOnyx.mergewith no navigation, which would strand the user on the loader.One deviation from the proposal text, and the reason for it: I wrote
leavePendingValidationFlowas auseCallbackrather than a plain function. The compliance check showsReimbursementAccountPage.tsxdoes not compile under React Compiler — it fails on both Babel and OXC with 3 × "Cannot access refs during render" onorigin/main, before any of my changes. Since the file isn't compiled, the no-manual-memoization rule doesn't apply to it and the surroundinguseCallbackidiom does. It also lets the escape effect list a real dependency instead of a lint suppression.Checks
typecheck,lint-changed,spell-changedand the storybook smoke test all pass. 18 bank-account and reimbursement suites pass (249 tests). The React Compiler check is byte-identical to theorigin/mainbaseline — same 3 pre-existing errors, only the line number shifts as the existing code moved down — so no regression and no new memoization divergence;USDVerifiedBankAccountFlowPage.tsxpasses both compilers before and after.Two things I did not do, stated plainly rather than left implied. The full Jest suite exceeded the local time budget, so CI is the first place it runs end to end;
--findRelatedTestsreports no test file covers either changed file directly, so the 18 suites above are the existing coverage. And I ran no manual verification — the PR carries no screenshots, and theTests,Offline testsandQA Stepssections are left as TODOs for you, seeded with the suggested steps from the proposal's acceptance criteria. The micro-deposit submit against a genuinely pending account is the one that still needs a real backend round trip.I added no unit tests. The change is navigation and render-gating in a screen with no existing test harness, so a meaningful test would mean building that harness — worth doing, but a larger change than this fix, and your call whether to fold it in.
view run
12 remaining items
melvin-bot commentedon Sep 16, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 16, 2026
Payment Summary
Resolving PRs:
Skip the Continue setup step for a pending USD bank account #100113
Reviewer: @ikevin127 owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
ikevin127 commentedon Sep 19, 2026
@mallenexpensify May I please have a payment summary on this one ? BZ Checklist completed above 🙌
melvin-bot commentedon Sep 21, 2026
@mallenexpensify Huh... This is 4 days overdue. Who can take care of this?
mallenexpensify commentedon Sep 22, 2026
Payment Summary
Contributor+: @ikevin127 due $250 via NewDot
quinthar commentedon Sep 27, 2026
Approved $250 to @ikevin127