Skip to content

[Paid] [$250] Contact methods - The Back and error dismiss buttons do not respond when adding existing account #72754

Closed

Description

@jponikarchuk

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: v9.2.32-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1309/folder/13176687/41236707/955761858?sort=-identifier
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Device used: Mac 15.4.1 Safari, Desktop, iPhone 13 iOS 18.6.2 Safari, Hybrid
App Component: User Settings

Action Performed:

  1. Navigate to https://staging.new.expensify.com
  2. Navigate to Account Settings > Profile > Contact Methods
  3. Select "New Contact Method."
  4. Enter an already registered email
  5. Enter the correct magic code
  6. Try to dismiss the error or click the back button

Expected Result:

The error can be dismissed by clicking the X button.
Clicking the back button closes the RHN.

Actual Result:

The Back and error dismiss buttons do not respond when adding existing account

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021980420509630047828
  • Upwork Job ID: 1980420509630047828
  • Last Price Increase: 2025-10-20
  • Automatic offers:
    • etCoderDysto | Contributor | 109195287
Issue OwnerCurrent Issue Owner: @RachCHopkins

Activity

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

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (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. etCoderDysto commented on Oct 16, 2025

    @etCoderDysto
    Contributor

    Proposal

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

    Contact methods - The Back and error dismiss buttons do not respond when adding existing account

    What is the root cause of that problem?

    We call clearError when validating magic code, and clearUnvalidatedNewContactMethodAction will be called and it will clear pendingContactAction data

    const validateAndSubmitForm = useCallback(() => {
    // Clear flow specific error
    clearError();
    // Clear "incorrect magic" code error

    clearError={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();

    Then we return early when we call onClose and clearError that makes back button and error clear button un responsive

    clearError={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    }}
    onClose={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));

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

    Inside clearError, we shouldn't call clearUnvalidatedNewContactMethodAction. Rather we should call clearPendingContactActionErrors since we only want to clear the error.

    clearError={() => {
    if (!pendingContactAction?.contactMethod) {
    return;

    clearError={() => {
                    if (!pendingContactAction?.contactMethod) {
                        return;
                    }
                    clearContactMethod(newContactMethod);
                    clearPendingContactActionErrors();
                }}
    

    What alternative solutions did you explore? (Optional)

    Optionally we can move clearContactMethod call and Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo)) above !pendingContactAction?.contactMethod check

    clearError={() => {
                    clearContactMethod(newContactMethod);
                    if (!pendingContactAction?.contactMethod) {
                        return;
                    }
    
                    clearUnvalidatedNewContactMethodAction();
                }}
                onClose={() => {
                    clearContactMethod(newContactMethod);
                    Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));
    
                    if (!pendingContactAction?.contactMethod) {
                        return;
                    }
                    clearUnvalidatedNewContactMethodAction();
                }}
    

    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.

  4. nyomanjyotisa commented on Oct 16, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Contact methods - The Back and error dismiss buttons do not respond when adding existing account

    What is the root cause of that problem?

    The successData from addNewContactMethod sets PENDING_CONTACT_ACTION.contactMethod to null

    const successData: OnyxUpdate[] = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.PENDING_CONTACT_ACTION,
    value: {
    contactMethod: null,
    validateCodeSent: null,
    actionVerified: true,
    errorFields: {
    actionVerified: null,
    },
    },
    },
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.ACCOUNT,
    value: {isLoading: false},
    },
    ];

    When the user tries to dismiss the error or click back, both callbacks check if pendingContactAction?.contactMethod exists and return early if it doesn't

    clearError={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    }}
    onClose={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));
    }}

    Since contactMethod is null, both callbacks return early without clearing the error or navigating back, making the buttons appear unresponsive

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

    Remove the pendingContactAction?.contactMethod checks from both callbacks. We should always allow the user to dismiss errors and navigate back

                clearError={() => {
                    clearContactMethod(newContactMethod);
                    if (pendingContactAction?.contactMethod) {
                        clearUnvalidatedNewContactMethodAction();
                    }
                }}
                onClose={() => {
                    clearContactMethod(newContactMethod);
                    if (pendingContactAction?.contactMethod) {
                        clearUnvalidatedNewContactMethodAction();
                    }
                    Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));
                }}

    clearError={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    }}
    onClose={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));
    }}

    What alternative solutions did you explore? (Optional)

    None

  5. ShridharGoel commented on Oct 16, 2025

    @ShridharGoel
    Contributor

    Proposal

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

    Users who try to add a contact method that already exists see the red error banner but cannot dismiss it or leave the flow. The X button and the back button do nothing, leaving the right-hand pane stuck open.

    What is the root cause of that problem?

    The clearError and onClose handlers inside NewContactMethodConfirmMagicCodePage short-circuit when pendingContactAction?.contactMethod is empty, which happens after the server tells us the contact already exists. Because the rest of the handler never runs, neither the pending action nor the navigation gets cleared, so the UI stays frozen.

    title={translate('delegate.makeSureItIsYou')}
    sendValidateCode={() => requestValidateCodeAction()}
    descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod})}
    validateCodeActionErrorField="addedLogin"
    validateError={validateLoginError}
    handleSubmitForm={addNewContactMethod}
    clearError={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    }}
    onClose={() => {
    if (!pendingContactAction?.contactMethod) {
    return;
    }
    clearContactMethod(newContactMethod);
    clearUnvalidatedNewContactMethodAction();
    Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));

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

    Update NewContactMethodConfirmMagicCodePage so we always clear the pending action and navigate away, while only removing the optimistic login record when it actually belongs to this flow.

    const shouldClearContactMethod = pendingContactAction?.contactMethod === newContactMethod;
    
    return (
        <ValidateCodeActionContent
            title={translate('delegate.makeSureItIsYou')}
            sendValidateCode={() => requestValidateCodeAction()}
            descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod})}
            validateCodeActionErrorField="addedLogin"
            validateError={validateLoginError}
            handleSubmitForm={addNewContactMethod}
            clearError={() => {
                if (shouldClearContactMethod) {
                    clearContactMethod(newContactMethod);
                }
                clearUnvalidatedNewContactMethodAction();
            }}
            onClose={() => {
                if (shouldClearContactMethod) {
                    clearContactMethod(newContactMethod);
                }
                clearUnvalidatedNewContactMethodAction();
                Navigation.goBack(ROUTES.SETTINGS_NEW_CONTACT_METHOD.getRoute(navigateBackTo));
            }}
        />
    );

    This keeps existing contact methods in place while letting the user close the modal, restoring both the dismiss button and the back button.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 20, 2025
  7. changed the title [-]Contact methods - The Back and error dismiss buttons do not respond when adding existing account[/-] [+][$250] Contact methods - The Back and error dismiss buttons do not respond when adding existing account[/+] on Oct 20, 2025
  8. melvin-bot commented on Oct 20, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 20, 2025
  10. melvin-bot commented on Oct 20, 2025

    @melvin-bot

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

  11. 12 remaining items

  12. dukenv0307 commented on Nov 24, 2025

    @dukenv0307
    Contributor

    @RachCHopkins Can you please process the payment?

  13. changed the title [-][$250] Contact methods - The Back and error dismiss buttons do not respond when adding existing account[/-] [+][Due for payment] [$250] Contact methods - The Back and error dismiss buttons do not respond when adding existing account[/+] on Nov 27, 2025
  14. RachCHopkins commented on Nov 27, 2025

    @RachCHopkins
    Contributor

    Payment Summary:

    Upwork job here

  15. RachCHopkins commented on Nov 27, 2025

    @RachCHopkins
    Contributor

    @etCoderDysto you have been paid!

    @dukenv0307 can you do the checklist please?

  16. changed the title [-][Due for payment] [$250] Contact methods - The Back and error dismiss buttons do not respond when adding existing account[/-] [+][Paid] [$250] Contact methods - The Back and error dismiss buttons do not respond when adding existing account[/+] on Nov 27, 2025
  17. dukenv0307 commented on Nov 28, 2025

    @dukenv0307
    Contributor

    BugZero Checklist:

    • [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/58934/files#r2570442102

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

    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:

    Test 1

    1. Navigate to Account Settings > Profile > Contact Methods
    2. Select "New Contact Method."
    3. Enter an already registered email
    4. Enter the correct magic code
    5. Tap on close button
    6. Verify that the error is cleared

    Test 2

    1. Navigate to Account Settings > Profile > Contact Methods
    2. Select "New Contact Method."
    3. Enter an already registered email
    4. Enter the correct magic code
    5. Tap on back button
    6. Verify that you are navigated back

    Test 3

    1. Navigate to Account Settings > Profile > Contact Methods
    2. Select "New Contact Method."
    3. Enter an already registered email
    4. Enter the correct magic code
    5. Clear the magic code
    6. Verify that the error message is cleared

    Test 4

    1. Navigate to Account Settings > Profile > Contact Methods
    2. Select "New Contact Method."
    3. Enter a new email
    4. Enter the correct magic code
    5. Enter a correct magic code sent to the newly added contact method
    6. Verify that the contact method is added successfully

    Test 5

    1. Go to Setting
    2. Security
    3. Add copilot
    4. Select User
    5. Select Access Level
    6. Click Add copilot
    7. Request magic code until “Failed to send a new magic code. Please wait a bit and try again.” Error is displayed
    8. Click on close button
    9. Verify that the error is cleared

    Test 6
    Precondition: You have added a copilot

    1. Go to Setting
    2. Go to Security
    3. Add copilot
    4. Click on the copilot
    5. Click on Change access level
    6. Request magic code until “Failed to send a new magic code. Please wait a bit and try again.” error is displayed
    7. Click on close button
    8. Verify that the error is cleared

    Test 7
    Precondition: You have set up Expensify card

    1. Go to a workspace settings
    2. Go to Expensify card
    3. Select any card type
    4. Fill all required fields until you reach the verification page
    5. Request magic code until “Failed to send a new magic code. Please wait a bit and try again.” error is displayed
    6. Click on close button
    7. Verify that the error is cleared

    Do we agree 👍 or 👎

  18. dukenv0307 commented on Nov 28, 2025

    @dukenv0307
    Contributor

    @RachCHopkins I completed the checklist. Thank you

  19. twisterdotcom commented on Dec 2, 2025

    @twisterdotcom
    Contributor

    @dukenv0307 has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-3f5e-a32e-a7ac-633ce01ff794
  20. melvin-bot commented on Dec 4, 2025

    @melvin-bot

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

  21. twisterdotcom commented on Dec 5, 2025

    @twisterdotcom
    Contributor

    Okay, Rach is out but you can request payment now @dukenv0307

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions