[Due for payment 2026-12-08] [$175] Bank Account - User does not land back on the country selector after closing the Plaid UI
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.39-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/83545950/folder/57527124/41236749/1969266086 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Android 16 / Samsung A34 App Component: Other
Action Performed:
Precondition: Logged into Expensify App with a new Expensifail account and reset the App's Cache.
- Open the Expensify App.
- Tap the "Account" icon.
- Tap "Wallet".
- Tap "Add bank account".
- Tap "Get reimbursed".
- Select "United States" from the "Where's your bank account located?" list. Go to Settings > Wallet > Add bank account.
- Tap "Next".
- Tap "Log into your bank".
- Tap the "X" icon on the "Plaid" card.
- Tap "Yes, exit" on the "Are you sure?"
Expected Result:
The user should land back on the country selector after closing the Plaid UI.
Actual Result:
The User does not land back on the country selector after closing the Plaid UI.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/9997f967-c185-4c3c-b775-9d517ce4d508
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7312952
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022121252902567865588
- Upwork Job ID: 2121252902567865588
- Last Price Increase: 2026-11-13
Issue Owner
Current Issue Owner: @mananjadhav
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/f22187b85a6ecedc492034c42a82e3fa9b93323cb8cde2ab312d67ef694ae424
https://platform.applause.com/services/links/v1/external/60344ae158ded82f1d482c841dbbf58157636d1de9e626922ec8d1221c0a3bb7
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)
Job added to Upwork: https://www.upwork.com/jobs/~022121252902567865588
🤖 Web test steps verification results: ⚠️ partial
Reached Add bank account on dev NewDot web, then encountered emailed-code account validation. Plaid cancellation remains untested; code evidence supports the navigation explanation below with medium confidence.
| Step | Status |
|---|---|
Open Expensify with a fresh accountFresh-account session was signed in with onboarding complete. |
✅ |
Open AccountAccount opened. |
✅ |
Open WalletWallet displayed Bank accounts and Add bank account. |
✅ |
Choose Add bank accountAccount validation requested an emailed six-digit security code. |
✅ |
Choose Get reimbursedBlocked by account validation. |
⚠️ |
Select United StatesNot reached. |
⚠️ |
Click NextNot reached. |
⚠️ |
Click Log into your bankNot reached. |
⚠️ |
Click X in PlaidNot reached. |
⚠️ |
Confirm Yes, exit — structured issue analysisDestination was not verified at runtime. Screenshot capture was unavailable.ProposalWhat is the root cause of that problem?The personal Plaid screen uses a destinationlessNavigation.goBack. The flow pushes connection methods between country selection and Plaid, so cancellation should return to connection methods—not country selection.Evidence: PlaidBankAccountStep.tsx:49–59 supplies the callback; AccountFlowEntryPoint.tsx:70–82 opens Plaid from connection methods. These are separately registered screens, and ordinary navigation pushes rather than replaces. What changes do you think we should make in order to solve the problem?For personal onboarding originating at country selection, make Plaid cancellation explicitly return to that existing country route, preserving its original parameters. Keep the existing fallback for entry paths without a country selector; do not change shared Plaid behavior globally.Add a navigation regression test asserting cancellation removes both Plaid and connection methods, restores country selection, and preserves retry behavior. Also cover entry without a country selector and successful Plaid completion. What alternative solutions did you explore?A missing web SDK callback is unlikely: the web adapter forwards exit. Two consecutive back calls would assume a fixed stack depth and could mishandle verification screens. Returning to connection methods could be intentional, but contradicts this issue’s stated expectation.Remaining confirmation: Reproduce using a verified account and capture the destination after cancellation. No introducing PR or production-log confirmation was established. Next Steps for Contributor+ team: To accept: @MelvinBot implement this to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal. |
⚠️ |
Proposal
What is the root cause of that problem?
When a user navigates to Settings > Wallet > Add bank account, selects "United States" in CountrySelection.tsx (lines 20–24) or WiseDepositAccountContent.tsx (lines 158–164), and confirms:
navigateToUSBankAccountFlow(isUserValidated)is called (navigateToUSBankAccountFlow.ts:10–16).- For a validated user, it navigates to
createDynamicRoute(DYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT_ENTRY_POINT.path, ROUTES.SETTINGS_WALLET). - This pushes the
AccountFlowEntryPointscreen (AccountFlowEntryPoint.tsx), which presents two connection methods: "Log into your bank" (Plaid) and "Connect manually". - When the user taps "Log into your bank",
handleConnectPlaid(lines 77–82) navigates toDYNAMIC_ROUTES.ADD_US_BANK_ACCOUNTwith subpagePLAID_BANK_ACCOUNT, pushingAddPersonalBankAccountPageonto the stack. - In
PlaidBankAccountStep.tsx(PlaidBankAccountStep.tsx:57),onExitPlaidis hardcoded toNavigation.goBack:onExitPlaid={Navigation.goBack} - When the user taps the exit "X" in Plaid and confirms "Yes, exit",
Navigation.goBack()pops the top route (AddPersonalBankAccountPage), returning the user to its immediate parent on the navigation stack:AccountFlowEntryPoint(the "Log into your bank" / "Connect manually" page).
Because AccountFlowEntryPoint was pushed onto the navigation stack between CountrySelection and PlaidBankAccountStep, a single Navigation.goBack() naturally returns to AccountFlowEntryPoint, not CountrySelection.
What changes do you think we should make in order to solve the problem?
Depending on product design intent, there are two clear paths:
Path A: If the desired behavior is to return directly to the Country Selector (ROUTES.SETTINGS_ADD_BANK_ACCOUNT)
If closing Plaid should return the user all the way back to the country selection list:
-
In
src/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsx, update the exit handler so that when navigating back from the Plaid step, if the flow was opened from the wallet/country flow, it navigates back toROUTES.SETTINGS_ADD_BANK_ACCOUNT(or falls back to standardNavigation.goBack()if not present):const handleExitPlaid = () => { Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT); };Because
Navigation.goBack(backToRoute)internally callsgoUpwhich inspects the stack usingfindRouteToPopTo, ifROUTES.SETTINGS_ADD_BANK_ACCOUNTis present in the stack, it will cleanly pop bothAddPersonalBankAccountPageandAccountFlowEntryPoint, landing the user directly onCountrySelection. IfROUTES.SETTINGS_ADD_BANK_ACCOUNTis not in the stack (e.g., opened from a direct route or other entry points),Navigation.goBack()gracefully falls back to the previous screen. -
Alternatively, in
src/pages/settings/Wallet/InternationalDepositAccount/subPages/AccountFlowEntryPoint.tsx, when the user selects Plaid, pass{forceReplace: true}toNavigation.navigate(or replace the route) soAccountFlowEntryPointdoes not remain on the stack under Plaid.
Path B: Clarification if current behavior is intentional UX (Not A Bug / Regression Test Update)
From an architectural and UX standpoint, returning to AccountFlowEntryPoint is arguably the superior and intended design:
- Preserves User Intent: If a user cancels Plaid because their bank is not supported or they do not wish to use online credentials, landing on
AccountFlowEntryPointimmediately allows them to tap "Connect manually" without having to re-select "United States" and re-advance from the country list. - Consistency with Header Navigation: In
AddPersonalBankAccountPage/index.tsx(line 236), tapping the header back button<executesNavigation.goBack(), which also returns toAccountFlowEntryPoint. Having Plaid exit and header back button behave consistently avoids jarring UX discrepancies. - Easy Traversal: The user can still return to
CountrySelectionat any point with a single tap of the back button<onAccountFlowEntryPoint.
If Contributor+ / BugZero confirms Path B is the intended behavior, the BrowserStack regression test case should be updated to reflect that AccountFlowEntryPoint is the expected landing screen when exiting Plaid. If Path A is preferred, Path A provides the clean, surgical fix.
What alternative solutions did you explore? (Optional)
- Calling
Navigation.goBack()twice: Discarded because hardcoding sequential pop calls is fragile, risks race conditions during screen transitions, and fails if the user navigated to Plaid via a different entry path. - Replacing
CountrySelectiondirectly when entering US flow: Discarded because users who tap the back button onAccountFlowEntryPointneed to be able to return toCountrySelectionto pick a different country.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user navigates to Account > Wallet > Add bank account (or Get reimbursed), selects United States on the Country Selector (Settings_Add_Bank_Account), continues through Log into your bank to open the Plaid flow, and then closes the Plaid UI (X -> Yes, exit), the app lands on the intermediate US entry-point screen (Add US bank account — Log into your bank / Connect manually) instead of returning to the Country Selector screen with United States still selected.
What is the root cause of that problem?
- Committed intermediate screen on the RHP stack:
When the user selects United States and taps Next on the Country Selector (
CountrySelection.tsx:20-24orWiseDepositAccountContent.tsx:201-205),navigateToUSBankAccountFlow.ts:10-16(anduseDynamicForwardPath.ts:36after OTP verification) pushesDYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT_ENTRY_POINT(AccountFlowEntryPoint.tsx) ontoSettingsModalStackNavigatoraboveSCREENS.SETTINGS.ADD_BANK_ACCOUNT. Tapping Log into your bank (AccountFlowEntryPoint.tsx:77-82) then pushesDYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT(AddPersonalBankAccountPage->PlaidBankAccountStep), resulting in:[Settings_Add_Bank_Account (Country Selector), Dynamic_Add_US_Bank_Account_Entry_Point, Dynamic_Add_US_Bank_Account (Plaid)]. PlaidBankAccountSteponly pops a single screen on Plaid exit: Insrc/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsx:57,<InputWrapper InputComponent={AddPlaidBankAccount} ... onExitPlaid={Navigation.goBack} />passesNavigation.goBackwith no target route. Confirming Yes, exit inside Plaid pops onlyDynamic_Add_US_Bank_Account(pop(1)), leaving the user onAccountFlowEntryPointinstead of popping back toSettings_Add_Bank_Account.
What changes do you think we should make in order to solve the problem?
Update onExitPlaid in src/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsx to pop back to the existing SCREENS.SETTINGS.ADD_BANK_ACCOUNT route when (and only when) it is present in the current navigator stack, while preserving its backTo parameter and selectedCountry component state:
-
Check the current stack for
SCREENS.SETTINGS.ADD_BANK_ACCOUNTand pop with its exactbackToparam:const navigation = useNavigation(); const handleExitPlaid = () => { const countrySelectorRoute = navigation.getState()?.routes.find((route) => route.name === SCREENS.SETTINGS.ADD_BANK_ACCOUNT); if (countrySelectorRoute) { const countrySelectorBackTo = (countrySelectorRoute.params as {backTo?: Route} | undefined)?.backTo; Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(countrySelectorBackTo)); return; } Navigation.goBack(); };Pass
onExitPlaid={handleExitPlaid}to<InputWrapper InputComponent={AddPlaidBankAccount} ... />. -
Why this exact approach avoids three subtle
Navigation.goBackpitfalls:ROUTES.SETTINGS_ADD_BANK_ACCOUNTis a route builder object ({route, getRoute}insrc/ROUTES.ts:2688-2696), not aRoutestring — passingROUTES.SETTINGS_ADD_BANK_ACCOUNTdirectly fails TypeScript compilation andgetStateFromPathat runtime;.getRoute(...)must be called.- Preserves
backToand triggers an atomicStackActions.pop(distanceToPop): When opened from Wallet orBankAccountPurposePage(src/libs/actions/BankAccounts.ts:225),Settings_Add_Bank_Accountcarries abackToparam (e.g.backTo=/settings/wallet), androuteParamsIgnoreinsrc/libs/Navigation/Navigation.ts:363does not ignorebackTo. CallingNavigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute())withoutcountrySelectorBackToeither fails param matching (compareParams: true-> falls intoREPLACEatNavigation.ts:617, duplicating the Country Selector on top ofAccountFlowEntryPoint) or, with{compareParams: false}, dispatchesPOP_TO(Navigation.ts:626), overwritingbackToon the existing route. MatchingcountrySelectorBackTohitsStackActions.pop(distanceToPop)(Navigation.ts:636), cleanly popping both US screens and revealing the already-mounted Country Selector withUnited Statesselected and its originalbackTointact. - Does not hijack direct US bank setup entry points: When
PlaidBankAccountStepis reached directly without the Country Selector on the stack (e.g.,ROUTES.BANK_ACCOUNT_PERSONALoropenPersonalBankAccountSetupView({shouldSetUpUSBankAccount: true})inBankAccounts.ts:222),countrySelectorRouteisundefined, sohandleExitPlaidfalls back toNavigation.goBack()instead ofREPLACE-navigating into the Wallet Country Selector.
-
Add a unit test covering
PlaidBankAccountSteponExitPlaidboth whenSCREENS.SETTINGS.ADD_BANK_ACCOUNT(withbackTo) is in the stack and when entered directly withoutSCREENS.SETTINGS.ADD_BANK_ACCOUNT.
(Note on product/QA expectation: If Product instead considers landing on AccountFlowEntryPoint intentional after PRs introducing the US entry-point chooser—so a user exiting Plaid can immediately pick Connect manually without re-selecting United States—then BrowserStack test case #41236749 should be updated rather than changing onExitPlaid. Otherwise, the stack-aware handleExitPlaid above restores the exact expected Country Selector behavior safely across all entry points.)
What alternative solutions did you explore?
- Using
{forceReplace: true}when navigating fromAccountFlowEntryPointtoAddPersonalBankAccountPage: Rejected because pressing the header Back button onManualBankAccountDetailsStep(orPlaidBankAccountStepbefore opening Plaid) usesuseDynamicBackPath(DYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT.path)(AddPersonalBankAccountPage/index.tsx:168), which intentionally returns the user toAccountFlowEntryPointso they can switch between Log into your bank and Connect manually. - Unconditionally calling
Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute()): Rejected because whenSCREENS.SETTINGS.ADD_BANK_ACCOUNTis absent from the stack (or has abackToquery parameter),goUp(Navigation.ts:617) performsREPLACEinstead of popping—corrupting the stack or redirecting non-Wallet callers to the Country Selector.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~014898525b9c53fc32
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user navigates to Account > Wallet > Add bank account, taps Get reimbursed, selects United States from the country selector, taps Log into your bank to open Plaid, and then closes the Plaid modal (X -> Yes, exit), the user does not land back on the country selector. Instead, they land on the intermediate SetupMethod ("Add bank account") screen.
What is the root cause of that problem?
In src/pages/EnablePayments/Wallet/AddBankAccount/substeps/PlaidStep.tsx:74:
<InputWrapper
InputComponent={AddPlaidBankAccount}
...
onExitPlaid={clearPersonalBankAccountSetupType}
/>
- When Plaid is exited via
onExitPlaid,PlaidStepcallsclearPersonalBankAccountSetupType, which resetssetupTypeinONYXKEYS.FORMS.PERSONAL_BANK_ACCOUNT_FORM_DRAFTtonull. - In
AddBankAccount.tsx:183,isSetupTypeChosenevaluates tofalsebecausesetupTypeisnull. Rather than popping the navigation stack back to the country selection screen (CountrySelectionStepinSettings_Add_Bank_Accountroute),AddBankAccountrenders the inlineSetupMethod.tsxcomponent within the current screen. - In contrast, in
src/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsx:57,onExitPlaidis correctly wired toNavigation.goBack:
BecauseonExitPlaid={Navigation.goBack}PlaidStep.tsxcallsclearPersonalBankAccountSetupTypeinstead of popping the route viaNavigation.goBack(), the user remains trapped inAddBankAccounton theSetupMethodview instead of returning to the country selector.
What changes do you think we should make in order to solve the problem?
-
Wire
Navigation.goBackon Plaid exit insrc/pages/EnablePayments/Wallet/AddBankAccount/substeps/PlaidStep.tsx:74: UpdateonExitPlaidto dismiss and pop back to the previous screen (the country selector) while cleaning up setup state:onExitPlaid={() => { clearPersonalBankAccountSetupType(); Navigation.goBack(); }}Or align directly with
PlaidBankAccountStep.tsx:57:- If arriving from
CountrySelection(whereNavigation.navigate(ROUTES.SETTINGS_ADD_BANK_ACCOUNT)ornavigateToUSBankAccountFlowpushed the route),Navigation.goBack()pops back to the country selector. - Clear any pending Plaid errors via
clearPersonalBankAccountErrors().
- If arriving from
-
Handle back press from
SetupMethod.tsx/AddBankAccount.tsx:152-155: EnsurehandleBackButtonPressinAddBankAccount.tsxpops back toROUTES.SETTINGS_ADD_BANK_ACCOUNT(Country Selector) if the user arrived via the international country selection flow rather than unconditionally exiting toROUTES.SETTINGS_WALLET. -
Automated tests:
- In
tests/unit/PlaidStepTest.tsx: Verify that invokingonExitPlaidtriggersNavigation.goBackand cleans up setup draft state. - In
tests/unit/AddBankAccountTest.tsx: Test that exiting Plaid when arriving from the country selector restores the country selector view without rendering the stuckSetupMethodscreen.
- In
What alternative solutions did you explore? (Optional)
- Only resetting
setupType: nullwithout callingNavigation.goBack(): Rejected because that is the exact current behavior that traps the user onSetupMethod.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Settings > Wallet > Add bank account, a policy admin taps Get reimbursed, lands on the country list ("Where's your bank account located?"), selects United States, taps Next, then Log into your bank. Closing the Plaid UI (X → Yes, exit) should return the user to that same country list, with United States still selected. Instead they land on the intermediate "Log into your bank" / "Connect manually" screen.
This is the same expected result as the earlier, already-fixed issue #54737. It reproduces on Android and web because both Plaid adapters call onExit() with no arguments; this is not a missing web SDK callback.
What is the root cause of that problem?
Plaid cancellation only pops one screen, and the US flow now has an extra screen between the country list and Plaid.
For a policy admin, Wallet > Add bank account opens ROUTES.SETTINGS_BANK_ACCOUNT_PURPOSE. Get reimbursed then calls openPersonalBankAccountSetupView({}), which navigates to the country list with the purpose page as backTo:
Navigation.navigate(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(Navigation.getActiveRoute()));
SCREENS.SETTINGS.ADD_BANK_ACCOUNT is InternationalDepositAccount. With the WISE_REIMBURSEMENTS beta it renders WiseDepositAccountContent; otherwise it renders the Corpay country list. Both treat United States (and PR, GU, VI via COUNTRIES_US_BANK_FLOW) as a jump into the US flow, and neither writes the selected country to Onyx or the form draft before leaving:
if (COUNTRIES_US_BANK_FLOW.includes(selectedCountry)) {
navigateToUSBankAccountFlow(isUserValidated);
return;
}
const onCountrySelected = () => {
if (COUNTRIES_US_BANK_FLOW.includes(selectedCountry)) {
navigateToUSBankAccountFlow(isUserValidated);
return;
}
selectedCountry therefore lives only in React state on the already-mounted country screen. A later remount reinitializes it from wiseBankAccountFields?.country ?? country (Wise) or formValues.bankCountry (Corpay), which may not be United States.
For a validated user, navigateToUSBankAccountFlow always appends the entry-point suffix to settings/wallet, not to the country-list route. That is required because DYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT_ENTRY_POINT.entryScreens is only [SCREENS.SETTINGS.WALLET.ROOT]:
function navigateToUSBankAccountFlow(isUserValidated: boolean | undefined) {
if (isUserValidated) {
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT_ENTRY_POINT.path, ROUTES.SETTINGS_WALLET));
return;
}
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.VERIFY_ACCOUNT.path));
}
The country list, entry point, and Plaid page are all screens in the same SCREENS.RIGHT_MODAL.SETTINGS stack (src/libs/Navigation/linkingConfig/config.ts). After Next, that stack is:
[…, Settings_Bank_Account_Purpose, Settings_Add_Bank_Account (country list, still mounted), Dynamic_Settings_Add_US_Bank_Account_Entry_Point, …]
Log into your bank then pushes DYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT (AccountFlowEntryPoint.tsx lines 77–82). PlaidBankAccountStep wires cancellation to a destinationless back:
onExitPlaid={Navigation.goBack}
Web (src/components/PlaidLink/index.tsx lines 39–42) and native (BaseNativePlaidLink.tsx lines 24–26) both invoke onExit() with no args, so this is a plain pop(1). The user lands on AccountFlowEntryPoint, not the country list.
This is also why a naive Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT) is unsafe even after calling .getRoute():
ROUTES.SETTINGS_ADD_BANK_ACCOUNTis a{route, getRoute}builder (src/ROUTES.tslines 2706–2715), not a path string.goUpcompares params by default, androuteParamsIgnoreinsrc/libs/Navigation/Navigation.ts(line 363) does not ignorebackTo.- On the reported path,
backToissettings/wallet/bank-account-purpose. A non-admin opening the country list from Wallet, or a KYC / queued-reimbursement entry, will have a differentbackTo.getRoute()with a missing or wrongbackTofails the param match, socanPopToRouteis false andgoUpreplaces the current screen (Navigation.tslines 617–620) instead of popping. That remounts the country list and can drop the United States selection, or it can leave the entry-point screen underneath. {compareParams: false}wouldPOP_TOand overwrite the existingbackTo.
If the user was not yet validated, navigateToUSBankAccountFlow first opens verify-account. After the magic code, useDynamicForwardPath.ts (line 36) forwards to the same wallet entry-point route. Popping back to the already-mounted country route still has to remove the entry point and Plaid, and any leftover verify-account screen, in one param-matching pop.
This is not the Enable Payments / KYC flow (src/pages/EnablePayments/Wallet/AddBankAccount/substeps/PlaidStep.tsx, which calls clearPersonalBankAccountSetupType and falls back to an inline SetupMethod view). That path never shows this country list.
What changes do you think we should make in order to solve the problem?
Update onExitPlaid in src/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsx only. Leave the header back button on AddPersonalBankAccountPage (line 236) as a plain Navigation.goBack(), so a user who is already on the Plaid account picker can still return to Log into your bank / Connect manually.
- On Plaid cancel, pop to the existing country-list route when it is in the Settings RHP stack, using that route's exact
backTo. Look upSCREENS.SETTINGS.ADD_BANK_ACCOUNTby walking the navigation state (the Settings modal stack underSCREENS.RIGHT_MODAL.SETTINGS, not onlyuseNavigation().getState().routes, so a nested or parent navigator cannot miss it). If it is present:
const handleExitPlaid = () => {
const countrySelectorRoute = findSettingsAddBankAccountRoute();
if (countrySelectorRoute) {
const countrySelectorBackTo = (countrySelectorRoute.params as {backTo?: Route} | undefined)?.backTo;
Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(countrySelectorBackTo));
return;
}
Navigation.goBack();
};
That hits StackActions.pop(distanceToPop) in goUp (Navigation.ts line 636), removes both the Plaid screen and AccountFlowEntryPoint (and a leftover verify-account screen, if any), and reveals the already-mounted country list with United States still selected and its original backTo intact.
- If the country list is not on the stack, keep today's
Navigation.goBack(). Direct US setup —openPersonalBankAccountSetupView({shouldSetUpUSBankAccount: true})orROUTES.BANK_ACCOUNT_PERSONAL— never pushedSettings_Add_Bank_Account, and must not be redirected into the Wallet country list.
Do not {forceReplace: true} when opening Plaid from AccountFlowEntryPoint. That would also make the header back button skip the method chooser, so the user could not switch to Connect manually without re-selecting the country.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
- Policy-admin path from Get reimbursed: stack is purpose → country list (
backTo=settings/wallet/bank-account-purpose) → entry point → Plaid.onExitPlaidpops to the existingSettings_Add_Bank_Accountroute, and the United States row is still selected (the screen was not remounted). - Non-admin Wallet path: same pop, but the country list's
backTois the Wallet route fromopenPersonalBankAccountSetupView. - Unvalidated path: after magic-code verification forwards to the entry point, Plaid cancel still pops to the existing country list rather than remounting it or leaving verify-account on top.
- Direct US setup with no
Settings_Add_Bank_Accounton the stack falls back to a singleNavigation.goBack(). - Header back on the first subpage of
AddPersonalBankAccountPagestill returns toAccountFlowEntryPoint, so Connect manually remains reachable. - Successful Plaid completion is unchanged.
What alternative solutions did you explore? (Optional)
- Leave the user on
AccountFlowEntryPointand update the BrowserStack case. Rejected because the issue's expected result, and the earlier #54737 contract, is the country list with United States still selected. The method chooser remains one header-back press away if the user really wants Connect manually. Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT)orgetRoute()without the existingbackTo. Rejected because the first is a route builder, not a path, and the second fails param matching and can REPLACE / remount the list, losing the in-memory United States selection.- Two raw
goBack()calls, or{forceReplace: true}when opening Plaid. Rejected as fragile across the unvalidated and direct-US entry paths, and because replace would break header-back to the method chooser. - Change
EnablePaymentsPlaidStep/SetupMethod. Rejected because that is a different flow and is not what these reproduction steps open.
📣 @PawanOzha! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01e1700af765e4270c
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user navigates to Account > Wallet > Add bank account > Get reimbursed, selects United States on the Country Selector (Settings_Add_Bank_Account), taps Next, taps Log into your bank (AccountFlowEntryPoint), and then closes the Plaid UI (X -> Yes, exit), the user lands on the intermediate US method-selection screen (AccountFlowEntryPoint: Log into your bank / Connect manually) instead of returning to the Country Selector screen with United States selected.
What is the root cause of that problem?
AccountFlowEntryPointsits on theSettingsModalStackNavigatorstack between the Country Selector and Plaid:- Selecting United States on the Country Selector (
src/pages/settings/Wallet/InternationalDepositAccount/subPages/CountrySelection.tsx:20-24orWiseDepositAccountContent.tsx:201-205) callsnavigateToUSBankAccountFlow(isUserValidated)(src/pages/settings/Wallet/InternationalDepositAccount/navigateToUSBankAccountFlow.ts:10-16), which pushesDYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT_ENTRY_POINT(AccountFlowEntryPoint.tsx) ontoSettingsModalStackNavigatoraboveSCREENS.SETTINGS.ADD_BANK_ACCOUNT. - Tapping Log into your bank (
AccountFlowEntryPoint.tsx:77-82) pushesDYNAMIC_ROUTES.ADD_US_BANK_ACCOUNT(AddPersonalBankAccountPage->PlaidBankAccountStep), creating the stack:[..., Settings_Add_Bank_Account (Country Selector), Dynamic_Settings_Add_US_Bank_Account_Entry_Point, Dynamic_Settings_Add_US_Bank_Account (Plaid)].
- Selecting United States on the Country Selector (
PlaidBankAccountSteppasses a destinationlessNavigation.goBacktoonExitPlaid(src/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsx:57):- Both the web (
src/components/PlaidLink/index.tsx:39-42) and native (BaseNativePlaidLink.tsx:24-26) Plaid adapters invokeonExit()with no arguments. Navigation.goBack()pops only 1 screen (Dynamic_Settings_Add_US_Bank_Account), leaving the user onAccountFlowEntryPointinstead of popping back to the mountedSettings_Add_Bank_AccountCountry Selector.
- Both the web (
What changes do you think we should make in order to solve the problem?
- Update
onExitPlaidinsrc/pages/AddPersonalBankAccountPage/substeps/PlaidBankAccountStep.tsxto pop back to the existingSCREENS.SETTINGS.ADD_BANK_ACCOUNTroute with its exactbackToparameter when present on the stack:
Passconst navigation = useNavigation(); const handleExitPlaid = () => { const countrySelectorRoute = navigation.getState()?.routes.find((route) => route.name === SCREENS.SETTINGS.ADD_BANK_ACCOUNT); if (countrySelectorRoute) { const countrySelectorBackTo = (countrySelectorRoute.params as {backTo?: Route} | undefined)?.backTo; Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(countrySelectorBackTo)); return; } Navigation.goBack(); };onExitPlaid={handleExitPlaid}to<InputWrapper InputComponent={AddPlaidBankAccount} ... />(line 57). - Why preserving
countrySelectorBackToand checking the stack is critical:- When opened via Get reimbursed,
openPersonalBankAccountSetupView(src/libs/actions/BankAccounts.ts:225) navigates toROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(Navigation.getActiveRoute()), attaching abackToparameter (settings/wallet/bank-account-purposeorsettings/wallet). - In
src/libs/Navigation/Navigation.ts:363, 617-636,goUpcompares route params (backTois not inrouteParamsIgnore). CallingNavigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute())withoutcountrySelectorBackTofails param matching and executesREPLACE(line 617), which remounts the Country Selector and loses its in-memoryselectedCountry = 'US'React state. - Passing
ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(countrySelectorBackTo)matches the mounted route's params and dispatchesStackActions.pop(distanceToPop)(line 636), cleanly popping bothDynamic_Settings_Add_US_Bank_AccountandDynamic_Settings_Add_US_Bank_Account_Entry_Point(plus any intermediateverify-accountroute) while keeping the mounted Country Selector's United States selection andbackTointact. - When
PlaidBankAccountStepis entered directly without the Country Selector in the stack (e.g.openPersonalBankAccountSetupView({shouldSetUpUSBankAccount: true})orROUTES.BANK_ACCOUNT_PERSONAL),countrySelectorRouteisundefinedandhandleExitPlaidfalls back toNavigation.goBack().
- When opened via Get reimbursed,
- Add unit tests verifying
onExitPlaidinPlaidBankAccountStepboth whenSCREENS.SETTINGS.ADD_BANK_ACCOUNT(withbackTo) is in the stack and when entered directly.
What alternative solutions did you explore? (Optional)
- Passing
{forceReplace: true}when navigating fromAccountFlowEntryPointtoAddPersonalBankAccountPage: Discarded because pressing the header Back button<onAddPersonalBankAccountPage(line 236) orManualBankAccountDetailsStepshould still return toAccountFlowEntryPointso the user can switch to Connect manually. - Calling
Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute())unconditionally: Discarded because a mismatchedbackToparam triggersREPLACE(losing the in-memoryUnited Statesselection) and redirects direct US bank setup flows into the Country Selector.
@MelvinBot please revise your proposal at https://github.com/Expensify/App/issues/106857#issuecomment-6856274071 and post the revision as its own comment, outside the test-step table.
I think the root cause is backwards. A destinationless Navigation.goBack in PlaidBankAccountStep pops one screen, and AccountFlowEntryPoint sits between the country list and Plaid, so cancel lands on "Log into your bank" / "Connect manually". That is the bug. The expected result is the country list with United States still selected.
On Plaid cancel only, when Settings_Add_Bank_Account is already on the Settings stack, go back to that route rebuilt with its existing backTo. A missing or different backTo makes goUp replace the screen and drop the in-memory selection. If that route is absent, keep a plain Navigation.goBack. Leave the header back button as a single goBack, and do not change shared Plaid behavior. What do you think?
Agreed—my earlier explanation reversed actual and expected behavior. This replaces the previous proposal.
Proposal
What is the root cause of that problem?
Plaid cancellation uses a destinationless Navigation.goBack, which pops one screen. Because AccountFlowEntryPoint sits between the country list and Plaid, cancellation returns to “Log into your bank” / “Connect manually”. That is the bug: it should reveal the existing country list with United States still selected.
What changes do you think we should make in order to solve the problem?
Change only the personal-bank Plaid cancellation handler:
- Look for the existing
Settings_Add_Bank_Accountroute in the active Settings stack. - If present, call
Navigation.goBack(ROUTES.SETTINGS_ADD_BANK_ACCOUNT.getRoute(existingBackTo)), using that route’s existingbackTo. - If absent, retain plain
Navigation.goBack().
Preserving backTo matters: a missing or different value prevents parameter matching, causing goUp to replace rather than pop to the existing screen. That can lose the country list’s in-memory selection.
Leave the header back button as one goBack and make no shared Plaid changes.
Regression coverage should verify:
- Cancel restores the existing country list with United States selected and its original
backTo. - Direct US setup without a country-list route retains ordinary back behavior.
- Header back still reaches the method chooser.
- Successful Plaid completion remains unchanged.
Supporting code evidence
PlaidBankAccountStep.tsx:49–59supplies the destinationless cancellation handler;AccountFlowEntryPoint.tsx:77–82opens Plaid from the method chooser.Navigation.ts:614–637replaces unmatched targets and pops matching ones.- Country selection lives in local state in
CountrySelection.tsx:16–29andWiseDepositAccountContent.tsx:87–95.
This revision is code-validated; Plaid cancellation has not been verified at runtime.
What alternative solutions did you explore? (Optional)
- Unconditionally target the country route: unsafe when absent or when
backTodiffers. - Two back calls: assumes a fixed stack depth.
- Replace the method chooser: changes header-back behavior.
- Change shared Plaid behavior: unnecessarily affects other flows.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement this proposal to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
@MelvinBot implement this proposal
🤖 Web test steps verification results: ❌ fail
Blocked on dev NewDot web: the existing browser rendered no UI, and no app tool session was available. None of the requested bank-flow behaviors could be verified.
| Step | Status |
|---|---|
Plaid exit restores the country list with United States selectedBlocked: browser snapshots returned zero nodes; waiting for Wallet timed out.![]() |
❌ |
Header back returns to the method chooserNot verified because the app UI was unavailable. |
❌ |
Direct US setup cancellation retains ordinary back behaviorNot verified because the app UI was unavailable. |
❌ |
Implemented in Preserve country selection when canceling personal bank Plaid, created as a draft and assigned to mananjadhav. Header back and shared Plaid behavior remain unchanged.
Checks: 51 targeted tests, lint, typecheck, compiler check, formatting, spelling, and Storybook smoke test passed. Full Jest run timed out after 10 minutes. Manual Tests/QA and successful Plaid completion verification remain outstanding.
view run · no recording available
@mananjadhav Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@mananjadhav Still overdue 6 days?! Let's take care of this!
PR marked ready for review.