Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 8 tasks
IuliiaHerets opened this issue Mar 5, 2025 · 20 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Mar 5, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 5, 2025
Copy link

melvin-bot bot commented Mar 5, 2025

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.

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Mar 6, 2025
Copy link

melvin-bot bot commented Mar 6, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021897762842116763600

@melvin-bot melvin-bot bot 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 Mar 6, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 6, 2025
Copy link

melvin-bot bot commented Mar 6, 2025

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

@linhvovan29546
Copy link
Contributor

linhvovan29546 commented Mar 8, 2025

🚨 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.

@melvin-bot melvin-bot bot added the Overdue label Mar 9, 2025
@linhvovan29546
Copy link
Contributor

Proposal updated

  • Add alternative solutions

Copy link

melvin-bot bot commented Mar 10, 2025

@fedirjh Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@fedirjh
Copy link
Contributor

fedirjh commented Mar 10, 2025

@linhvovan29546 Your proposal makes sense to me. I think we should just early return when we got a delete pending field.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 10, 2025

Triggered auto assignment to @francoisl, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 10, 2025
Copy link

melvin-bot bot commented Mar 10, 2025

📣 @linhvovan29546 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 11, 2025
@linhvovan29546
Copy link
Contributor

PR is ready for review!

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Mar 20, 2025
@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Mar 20, 2025
@melvin-bot melvin-bot bot changed the title [$250] Profile - RBR appears in Profile settings after removing second contact method [Due for payment 2025-03-27] [$250] Profile - RBR appears in Profile settings after removing second contact method Mar 20, 2025
Copy link

melvin-bot bot commented Mar 20, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 20, 2025
Copy link

melvin-bot bot commented Mar 20, 2025

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:

Copy link

melvin-bot bot commented Mar 20, 2025

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 27, 2025
@NicMendonca
Copy link
Contributor

Payment summary

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

@NicMendonca
Copy link
Contributor

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

Copy link

melvin-bot bot commented Apr 1, 2025

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

@melvin-bot melvin-bot bot added the Overdue label Apr 1, 2025
@NicMendonca
Copy link
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 👎

@fedirjh
Copy link
Contributor

fedirjh commented Apr 2, 2025

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 👎

@melvin-bot melvin-bot bot removed the Overdue label Apr 2, 2025
@NicMendonca
Copy link
Contributor

Thanks! reposting payment summary - #57870 (comment)

@garrettmknight
Copy link
Contributor

$250 approved for @fedirjh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

6 participants