Skip to content

[Due for payment 2025-05-14] [$250] Web - Expensify Card - Expensify Card page reloads after closing bank account setup RHP #58807

Closed

Description

@lanitochka17

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.16-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace
  3. Go to workspace settings > More features
  4. Enable Expensify Card
  5. Go to Expensify Card
  6. Click Issue new card
  7. Click Upgrade to USD if prompted
  8. Click RHP back button or click outside the RHP

Expected Result:

Expensify Card page will not reload after closing bank account setup RHP. (The issue was previously fixed in this PR #48613
).

Actual Result:

Expensify Card page reloads after closing bank account setup RHP

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6776895_1742479857654.20250320_220846.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021903124259903434822
  • Upwork Job ID: 1903124259903434822
  • Last Price Increase: 2025-04-18
  • Automatic offers:
    • nyomanjyotisa | Contributor | 107008958
Issue OwnerCurrent Issue Owner: @maddylewis

Activity

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

    @melvin-bot

    Triggered auto assignment to @maddylewis (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. nyomanjyotisa commented on Mar 20, 2025

    @nyomanjyotisa
    Member

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-10 13:06:30 UTC.

    Proposal

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

    Expensify Card page reloads after closing bank account setup RHP

    What is the root cause of that problem?

    We use useFocusEffect for the fetchExpensifyCards which will execute the fetchExpensifyCards everytime it refocused

    We remove the && !cardsList from the isLoading condition in this PR #56331

    const isLoading = !isOffline && (!cardSettings || cardSettings.isLoading);

    So it make the isLoading true everytime cardFeeds.isLoading is true

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

    Update to useEffect to only execute the fetchExpensifyCards every rerender only, and make it consistent with WorkspaceCompanyCardPage

    useFocusEffect(fetchExpensifyCards);

        useEffect(() => {
            fetchExpensifyCards();
        }, [fetchExpensifyCards]);
    
    -1-New-Expensify.mp4

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

    None

    What alternative solutions did you explore? (Optional)

    We should add isEmptyObject(cardsList) to the isLoading condition like we did in Company Cards here

    const isLoading = !isOffline && (!cardSettings || (cardSettings.isLoading && isEmptyObject(cardsList)));
    

    This makes the behavior consistent both on Expensify Card & Company Cards. And we need this to prevent the spinner show everytime user opens the page

    We should update to useEffect to make it consistent with WorkspaceCompanyCardPage

    useFocusEffect(fetchExpensifyCards);

        useEffect(() => {
            fetchExpensifyCards();
        }, [fetchExpensifyCards]);
    
  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 21, 2025
  5. changed the title [-]Web - Expensify Card - Expensify Card page reloads after closing bank account setup RHP[/-] [+][$250] Web - Expensify Card - Expensify Card page reloads after closing bank account setup RHP[/+] on Mar 21, 2025
  6. melvin-bot commented on Mar 21, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 21, 2025
  8. melvin-bot commented on Mar 21, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External)

  9. huult commented on Mar 23, 2025

    @huult
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-03-27 15:09:05 UTC.

    Proposal

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

    Expensify Card page reloads after closing bank account setup RHP

    What is the root cause of that problem?

    When we close the RHP while cardsList is empty, cardSettings is also triggered to load by useFocusEffect, causing cardSettings.isLoading to become true, which results in the loading indicator appearing and leads to this issue.

    const isLoading = !isOffline && (!cardSettings || cardSettings.isLoading);

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

    To resolve this issue, we simply prevent calling openPolicyExpensifyCardsPage when cardsList is empty.

    const fetchExpensifyCards = useCallback(() => {
    openPolicyExpensifyCardsPage(policyID, workspaceAccountID);
    }, [policyID, workspaceAccountID]);

    update to:

        const fetchExpensifyCards = useCallback(() => {
            if (isEmptyObject(cardsList)) {
                return;
            }
            openPolicyExpensifyCardsPage(policyID, workspaceAccountID);
        }, [cardsList, policyID, workspaceAccountID]);
    Screen.Recording.2025-03-23.at.23.47.25.mov

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

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

    "I don't think we need to fetch Expensify cards when the Connect bank account modal is closed, since nothing has changed. useFocusEffect(fetchExpensifyCards); is only triggered on navigation, I believe.

    1. We check if the previous screen was a modal.

    add

        const [modal] = useOnyx(ONYXKEYS.MODAL);
        const modalWasVisibleRef = useRef(false);
    
        useEffect(() => {
            // Track if modal is or was recently visible
            if (!modal?.isVisible) {
                return;
            }
    
            modalWasVisibleRef.current = true;
        }, [modal?.isVisible]);
    1. We should return early if the previous RPH was a closed modal.

    const fetchExpensifyCards = useCallback(() => {
    openPolicyExpensifyCardsPage(policyID, workspaceAccountID);
    }, [policyID, workspaceAccountID]);

    update to

        const fetchExpensifyCards = useCallback(() => {
            if (modalWasVisibleRef.current) {
                modalWasVisibleRef.current = false; 
                return;
            }
            openPolicyExpensifyCardsPage(policyID, workspaceAccountID);
        }, [policyID, workspaceAccountID]);
  10. melvin-bot commented on Mar 25, 2025

    @melvin-bot

    @rojiphil Whoops! This issue is 2 days overdue. Let's get this updated quick!

  11. melvin-bot commented on Mar 27, 2025

    @melvin-bot

    @rojiphil Huh... This is 4 days overdue. Who can take care of this?

  12. 44 remaining items

  13. melvin-bot commented on May 7, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.40-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-05-14. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on May 7, 2025

    @melvin-bot

    @rojiphil @maddylewis @rojiphil The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. rojiphil commented on May 13, 2025

    @rojiphil
    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
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [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:

    • [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: Not Required. The existing checklist is good enough to capture such issues.

    • [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.

    Regression Test Proposal

    Precondition:

    1. Enable Expensify Card for a workspace.

    Test:

    1. Navigate to Workspace settings -> Expensify Card
    2. Click Issue new card (upgrade to USD if prompted)
    3. Click RHP back button or click outside the RHP
    4. Verify that Expensify Card page is not reloaded after closing the bank account setup

    Do we agree 👍 or 👎

  16. rojiphil commented on May 13, 2025

    @rojiphil
    Contributor

    @maddylewis BZ checklist is done. Thanks.

  17. maddylewis commented on May 15, 2025

    @maddylewis
    Contributor

    will issue payments today!

  18. maddylewis commented on May 15, 2025

    @maddylewis
    Contributor

    Payment Overview + Final To-Dos

  19. garrettmknight commented on May 20, 2025

    @garrettmknight
    Contributor

    $250 approved for @rojiphil

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

Metadata

Metadata

Labels

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 contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions