Skip to content

[$125] Wallet - Country search scrolls to incorrect line for some letters #58017

Closed

Description

@IuliiaHerets

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.1.10-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5702032
Email or phone of affected tester (no customers): applausetester+030725dr053@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: MacOS 14.7.4 / Safari, Chrome, Desktop. iPhone 15 Pro / 18.3.1. Google Pixel 5 / Android 14
App Component: User Settings

Action Performed:

  1. Login to NewDot with a new Expensifail account
  2. Go to Settings > Wallet
  3. Click Add bank account
  4. Verify your country is selected by default (eg. United States)
  5. In the search bar, enter the first letter of another country. For example - N, A, D, E etc.
  6. Select another country (eq. Cambodia) and try searching by letters again.

Expected Result:

Country search scrolls to the correct country starting with these letters.

Actual Result:

For some first letters the country search scrolls to countries that start with a different letter. Incorrect letters will vary depending on the country already selected by default.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6763951_1741350688270.iOS-Wallet-Search-Incorrect-Scroll.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021898763466530762704
  • Upwork Job ID: 1898763466530762704
  • Last Price Increase: 2025-03-09
  • Automatic offers:
    • FitseTLT | Contributor | 106479043
Issue OwnerCurrent Issue Owner: @ahmedGaber93

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 7, 2025
  2. melvin-bot commented on Mar 7, 2025

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. FitseTLT commented on Mar 7, 2025

    @FitseTLT
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-03-07 16:15:55 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Wallet - Country search scrolls to incorrect line for some letters

    What is the root cause of that problem?

    When the search key contains letters from the currently selected item, the selected item will still be in the list but its index might change (because the relative index will change as the number of items above it change) then setFocusedIndex will be called with the current new index of the selected item

    const selectedItemIndex = useMemo(
    () => (initiallyFocusedOptionKey ? flattenedSections.allOptions.findIndex((option) => option.isSelected) : -1),
    [flattenedSections.allOptions, initiallyFocusedOptionKey],
    );
    useEffect(() => {
    if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
    return;
    }
    setFocusedIndex(selectedItemIndex);
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
    }, [selectedItemIndex]);

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

    This feature is implemented in #54457 but caused this issue. So we should disable it if there is a search string like:

    if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
    return;

     if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex || textInputValue) {
                return;
    

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    The test created for the original pr suffices.

    What alternative solutions did you explore? (Optional)

  4. nyomanjyotisa commented on Mar 7, 2025

    @nyomanjyotisa
    Member

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Wallet - Country search scrolls to incorrect line for some letters

    What is the root cause of that problem?

    We update the focusedIndex once the flattenedSections.allOptions is updated. This is necessary to update the focusedIndex when there is a changes on Backend especially for Priority mode selection in this issue #54457

    But, we also update the focusedIndex when the new data of flattenedSections.allOptions coming from search result

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

    Return early if the new data of flattenedSections.allOptions coming from search result

    useEffect(() => {
    if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
    return;
    }
    setFocusedIndex(selectedItemIndex);
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
    }, [selectedItemIndex]);

        useEffect(() => {
            if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex || prevTextInputValue !== textInputValue) {
                return;
            }
            setFocusedIndex(selectedItemIndex);
            // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
        }, [selectedItemIndex]);
    

    Additionally we can set focus to the default value if the textInputValue empty if needed

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Or we can do like this instead of using existing prevTextInputValue value

    const prevTextInputValueRef = useRef(textInputValue);
    
    useEffect(() => {
        if (prevTextInputValueRef.current !== textInputValue) {
            prevTextInputValueRef.current = textInputValue;
            return;
        }
    
        if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
            return;
        }
    
        setFocusedIndex(selectedItemIndex);
    }, [selectedItemIndex]);
    
    
  5. changed the title [-]Wallet - Country search scrolls to incorrect line for some letters[/-] [+][$125] Wallet - Country search scrolls to incorrect line for some letters[/+] on Mar 9, 2025
  6. melvin-bot commented on Mar 9, 2025

    @melvin-bot

    ⚠️ Could not update price automatically because there is no linked Upwork Job ID. The BZ team member will need to update the price manually in Upwork.

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    and removed on Mar 9, 2025
  8. melvin-bot commented on Mar 9, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 9, 2025
  10. 17 remaining items

  11. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 28, 2025
  12. melvin-bot commented on Mar 28, 2025

    @melvin-bot

    Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  13. mallenexpensify commented on Mar 28, 2025

    @mallenexpensify
    Contributor

    @jliexpensify I'm going to be OOO and offline for two weeks so I'm reassigning, will pick back up upon my return, thx

  14. FitseTLT commented on Mar 28, 2025

    @FitseTLT
    Contributor

    Payment is due today

  15. ahmedGaber93 commented on Mar 29, 2025

    @ahmedGaber93
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other: Applause Internal Team
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/54457/files#r2019991575

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    1. Go to Settings > Wallet
    2. Click Add bank account
    3. Verify your country is selected by default (e.g. United States)
    4. In the search bar, enter the first letter of another country which is also in the selected country. For example - N, A, D, E for United States etc.
    5. Verify it scrolls and focuses on the first item in the search result.
    6. clear search text
    7. Verify it scrolls back and focus on the selected item.

    Do we agree 👍 or 👎

  16. ahmedGaber93 commented on Mar 29, 2025

    @ahmedGaber93
    Contributor

    @jliexpensify It looks the automation was failed here, this issue was due for payment yesterday.

    Image

  17. jliexpensify commented on Mar 30, 2025

    @jliexpensify
    Contributor

    Payment Summary

    Upwork job

  18. jliexpensify commented on Mar 30, 2025

    @jliexpensify
    Contributor

    Paid and job closed.

  19. JmillsExpensify commented on Apr 25, 2025

    @JmillsExpensify
    Contributor

    $125 approved for @ahmedGaber93

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions