Skip to content

List does not scroll up to show selected country when returning from Add bank account page #87454

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.55-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #85447
Email or phone of affected tester (no customers): applausetester+sjois2jd@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: User Settings

Action Performed:

Precondition:

  • Have at least one workspace.
  1. Go to staging.new.expensify.com
  2. Go to Account > Wallet.
  3. Click Add bank account.
  4. Click Get reimbursed.
  5. Scroll down and select any country.
  6. Click RHP back button.
    → List scrolls to the top with the selected country visible.
  7. Close the RHP.
  8. Click Add bank account.
  9. Click Make payments.
  10. Scroll down and select any country.
  11. Click RHP back button.
    → List does not scroll to the top, The selected country is not visible unless manually scrolled up.

Expected Result:

In Step 10, the selected country will be highlighted.
In Step 11, the list will scroll to the top with the selected country visible.

Actual Result:

In Step 10, the selected country is not highlighted.
In Step 11, the list does not scroll to the top, The selected country is not visible unless manually scrolled up.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7125412_1775699556358.11.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @marufsharifi

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Apr 9, 2026
  2. melvin-bot commented on Apr 9, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #85447

  3. melvin-bot commented on Apr 9, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Apr 9, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Apr 9, 2026

    @OSBotify
    Contributor

    Investigation Summary. Classification: Frontend bug. Causing PR: #85447 - fix: stabilize reopen ordering in basic pickers by @marufsharifi (High confidence). Recommendation: REVERT. PR 85447 introduced broken behavior in the Make payments country selection flow via useInitialSelection hook with resetOnFocus:true. The International Deposit Account sub-page navigation does not trigger useFocusEffect on back navigation the same way as the BankAccountPurposePage flow, so initialSelectedValue retains an outdated snapshot, causing moveInitialSelectionToTopByValue to not bring the selected country to the top and the highlight/scroll not to trigger. Assigned: @marufsharifi @linhvovan29546 @srikarparsi. Labels: DeployBlockerCash kept, DeployBlocker to be removed.

  6. removed
    DeployBlockerIndicates it should block deploying the API
    on Apr 9, 2026
  7. marufsharifi commented on Apr 9, 2026

    @marufsharifi

    @srikarparsi, please assign me to take care of it. thanks.

  8. MelvinBot commented on Apr 9, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The "Make payments" CountrySelection component (BankAccountPurposePage/substeps/CountrySelection.tsx:51) stores the selected country only in local React state:

    const [selectedCountry, setSelectedCountry] = useState<string>(initialCountry);
    

    When the user selects a country, taps "Next" (which navigates to the bank account flow), and then presses back, BankAccountPurposePage toggles showCountrySelection back to false (index.tsx:18-19), unmounting the CountrySelection component. When the user re-enters the flow, CountrySelection remounts with a fresh useState, losing the user's prior selection entirely. This means selectedCountry resets to initialCountry (derived from policy currency, which may be empty), so nothing is highlighted and the list isn't reordered to show the selection at top.

    In contrast, the "Get reimbursed" flow (InternationalDepositAccount/subPages/CountrySelection.tsx:15) initializes from formValues.bankCountry, which is persisted to Onyx by fetchCorpayFields. So on remount, the selection survives.

    Additionally, PR #85447 introduced shouldScrollToFocusedIndex={false} on the SelectionList in CountrySelectionList.tsx:94, which prevents the list from auto-scrolling to the selected item even when useInitialSelection correctly captures the value on focus.

    What changes do you think we should make in order to solve the problem?

    Persist the selected country in BankAccountPurposePage so it survives the unmount/remount cycle of CountrySelection:

    1. Lift selectedCountry state up from CountrySelection into BankAccountPurposePage (which stays mounted throughout). Pass it down as a prop along with the setter. This way, when showCountrySelection toggles off and back on, the previously selected country is preserved.

    2. Alternatively, persist the selection to the reimbursement account draft via updateReimbursementAccountDraft on each country tap (not just on confirm), mirroring how the "Get reimbursed" flow persists via fetchCorpayFields. Then initialize selectedCountry from the draft.

    Option 1 is simpler and more consistent with the existing component structure.

    What alternative solutions did you explore? (Optional)

    • Re-enabling shouldScrollToFocusedIndex — this would only fix the scroll-to-top behavior but not the missing highlight, since the root issue is the state being lost on remount.
    • Storing the selection in Onyx (similar to the "Get reimbursed" flow) — viable but heavier than lifting state to the parent, and requires cleanup logic.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  9. IuliiaHerets commented on Apr 10, 2026

    @IuliiaHerets

    iPhone 13 / iOS 26.4
    v9.3.57-1
    not repro

    wallet.MP4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions