Skip to content

[Due for payment 2025-03-27] [$250] Profile - RBR appears in Profile settings after removing second contact method #57870

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.9-2
Reproducible in staging?: Yes
Reproducible in production?: No
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: https://expensify.testrail.io/index.php?/cases/view/2654630
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: iPhone 15 iOS 18.1.1 Safari, MacBook Air Sonoma 14.1
App Component: User Settings

Action Performed:

Preconditions: gmail account added a second contact method (email)

  1. Navigate to Settings tab - Profile - Contact method
  2. Select a secondary contact method
  3. Click Remove

Expected Result:

Secondary contact method is removed from the list without any error

Actual Result:

Red dot appears in Profile after removing second contact method. The RBR is removed after clearing cache.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6740286_1739339201560.ScreenRecording_02-11-2025_21-33-18_1.mp4
Bug6740286_1739339201560.Recording__421.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021897762842116763600
  • Upwork Job ID: 1897762842116763600
  • Last Price Increase: 2025-03-06
  • Automatic offers:
    • linhvovan29546 | Contributor | 106463713
Issue OwnerCurrent Issue Owner: @fedirjh

Activity

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

    @melvin-bot

    Triggered auto assignment to @NicMendonca (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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 6, 2025
  4. melvin-bot commented on Mar 6, 2025

    @melvin-bot
  5. changed the title [-]Profile - RBR appears in Profile settings after removing second contact method[/-] [+][$250] Profile - RBR appears in Profile settings after removing second contact method[/+] on Mar 6, 2025
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 6, 2025
  7. melvin-bot commented on Mar 6, 2025

    @melvin-bot

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

  8. linhvovan29546 commented on Mar 8, 2025

    @linhvovan29546
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-03-08 12:09:33 UTC.

    Proposal

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

    Profile - RBR appears in Profile settings after removing second contact method

    What is the root cause of that problem?

    We remove contactMethod here

    API.write(WRITE_COMMANDS.DELETE_CONTACT_METHOD, parameters, {optimisticData, successData, failureData});
    Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(backTo));

    After remove contactMethod, we back to the SETTINGS_CONTACT_METHODS page. However, since Onyx updates and navigation asynchronously, As a result, we remain in ContactMethodDetailsPage for a short time, then a useEffect triggers resetContactMethodValidateCodeSentState.
    useEffect(() => {
    if (loginData?.validatedDate) {
    return;
    }
    resetContactMethodValidateCodeSentState(contactMethod);
    }, [contactMethod, loginData?.validatedDate]);

    This causes the ValidateCodeActionForm to be displayed abit.
    useEffect(() => {
    setIsValidateCodeFormVisible(!loginData?.validatedDate);
    }, [loginData?.validatedDate, loginData?.errorFields?.addedLogin]);

    which then requests the REQUEST_CONTACT_METHOD_VALIDATE_CODE command. Since we just deleted that second contact method, this request fails, leading to an RBR appearing.
    sendValidateCode={() => requestContactMethodValidateCode(contactMethod)}

    Image Image

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

    We should not reset the contact method if there is a previously pending delete action

    useEffect(() => {
    if (loginData?.validatedDate) {
    return;
    }
    resetContactMethodValidateCodeSentState(contactMethod);
    }, [contactMethod, loginData?.validatedDate]);

        const prevLoginData = usePrevious(loginData);
    ....
        useEffect(() => {
            if (loginData?.validatedDate) {
                return;
            }
            if(prevLoginData?.pendingFields?.deletedLogin){ // new
                return;
            }
            resetContactMethodValidateCodeSentState(contactMethod);
        }, [contactMethod, loginData?.validatedDate, prevLoginData?.pendingFields?.deletedLogin]);

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

    N/A, this is a navigation issue. However, we could simulate Onyx data and assert that the resetContactMethodValidateCodeSentState is not called after deleting a contact.

    What alternative solutions did you explore? (Optional)

    1. We can return early if prevValidatedDate has a value instead of prevDeletedLogin.
    2. We can return early if this is not the default contact method.
  9. linhvovan29546 commented on Mar 9, 2025

    @linhvovan29546
    Contributor

    Proposal updated

    • Add alternative solutions
  10. 18 remaining items

  11. melvin-bot commented on Mar 20, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.15-9 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-03-27. 🎊

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

  12. melvin-bot commented on Mar 20, 2025

    @melvin-bot

    @fedirjh @NicMendonca @fedirjh 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]

  13. NicMendonca commented on Mar 28, 2025

    @NicMendonca
    Contributor

    Payment summary

    C+: @fedirjh - $250 via NewDot Manual Requests
    Contributor: @linhvovan29546 - $250 paid via Upwork (✅ paid)

  14. NicMendonca commented on Mar 28, 2025

    @NicMendonca
    Contributor

    @fedirjh just a bump on the checklist before we can close this out!

  15. melvin-bot commented on Apr 1, 2025

    @melvin-bot

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

  16. NicMendonca commented on Apr 1, 2025

    @NicMendonca
    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:
    • [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:

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

    Precondition:

    Test:

    Do we agree 👍 or 👎

  17. fedirjh commented on Apr 2, 2025

    @fedirjh
    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:
    • [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: fix: unable to receive New Magic Codes for Primary Contact #55498 (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: 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.

    N/A we have both regression test and we have implemented automated test

    Regression Test Proposal Template
    • [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

    Precondition:

    Test:

    Do we agree 👍 or 👎

  18. NicMendonca commented on Apr 2, 2025

    @NicMendonca
    Contributor

    Thanks! reposting payment summary - #57870 (comment)

  19. garrettmknight commented on Apr 22, 2025

    @garrettmknight
    Contributor

    $250 approved for @fedirjh

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