Skip to content

[Due for payment 2026-10-23] Onboarding - Add work email button loads infinitely after returning from magic code & readding #104062

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.9-4
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #103652
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with new Gmail account.
  3. Click Skip on work email step.
  4. Click Join my company workspace.
  5. Enter any email with private domain (eg, @gd.lowdn.com).
  6. Click Add work email.
  7. Click app back button.
  8. Click Add work email.

Expected Result:

Magic code step will open.

Actual Result:

Add work email button loads infinitely.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7286919_1792044270856.12.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7286919

Issue OwnerCurrent Issue Owner: @abzokhattab

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 15, 2026
  2. applause-bot commented on Oct 15, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/73e19901419f88eae94e56a7faee1f31da19bb24f7363fbedd22642b6da83747

  3. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #103652

  4. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    @iwiznia @abzokhattab you have been assigned to this deploy blocker because you reviewed the offending PR: #103652

  5. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    @carlosmiceli you have been assigned to this deploy blocker because you authored the offending PR: #103652

  6. melvin-bot commented on Oct 15, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  7. github-actions commented on Oct 15, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  8. changed the title [-]Onboarding- Add work email button loads infinitely after returning from magic code & readding[/-] [+]Onboarding - Add work email button loads infinitely after returning from magic code & readding[/+] on Oct 15, 2026
  9. MelvinBot commented on Oct 15, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: [Payment due @abzokhattab] Add the join-workspace onboarding intent and Concierge follow up tasks by carlosmiceli (High confidence)

    Recommendation: Roll forward

    A one-line fix in BaseOnboardingWorkEmail.tsx resolves this. Reverting would pull an 80+ file feature that was already reverted and re-landed once, and follow-up PRs build on it. If a fix can't land quickly, revert #103652.

    Root cause: On the second "Add work email" click, the email already equals session.email. So the same-email branch only sets shouldValidate: false and relies on the effect to navigate. The Join-Workspace effect branch that #103652 added returns early when hasSubmittedWorkEmail is false. That flag is local state, and it resets because the screen remounts after Back. Nothing navigates and no request is sent, so the button spinner never stops.

    Suggested fix:

    if (sessionEmail && submittedWorkEmail.toLowerCase() === sessionEmail.toLowerCase()) {
        setHasSubmittedWorkEmail(true);
        setOnboardingShouldValidate(false);
        return;
    }

    With both values set, the existing Join-Workspace branch goes to the magic code step (L179). Non-join flows never read hasSubmittedWorkEmail, so this fix doesn't change them.

    📋 Detailed analysis

    Sequence

    1. First submit (step 6): submitWorkEmail sets hasSubmittedWorkEmail = true and calls AddWorkEmail (L250-L253). A new private domain becomes the unvalidated primary login (session.email) with shouldValidate: false. The screen is replaced by the magic code step.
    2. Back (step 7): BaseOnboardingPrivateDomain calls updateOnboardingValuesAndNavigation. It resets shouldValidate and returns to a freshly mounted work email screen, so hasSubmittedWorkEmail is false.
    3. Second submit (step 8): The draft email equals sessionEmail, so the code takes the same-email branch and returns early. The Join-Workspace effect gate blocks navigation. The older non-join path (L191-L205) has no such gate, which is why only this intent breaks.
    4. Spinner: FormProvider defaults shouldShowLoadingImmediatelyOnPress to true. usePressLoading keeps the spinner on until the form's isLoading turns true or the screen regains focus. Neither happens on this path.

    The bug reproduces only for a new domain. If the domain already has an account, shouldValidate is true and session.email doesn't change. The second click then calls AddWorkEmail normally.

    Other staging PRs ruled out

    #103532, #103537, #104016, #103837, #103414, #103832, and #103718 don't touch this submit or navigation path.

    Regression test

    Add a case to tests/ui/WorkEmailOnboardingNavigation.tsx:

    • Given the join intent and a session.email equal to the draft email, on a fresh mount,
    • When the user submits,
    • Then the user lands on the magic code step.

    Suggested AI code review rule

    This class of bug has been fixed before (#96087, #99344, #100044, #102198). A rule for app-coding-standards could catch it:

    • Rule: Every FormProvider submit path must start loading or leave the screen.
    • Condition: Flag an onSubmit passed to <FormProvider> without shouldShowLoadingImmediatelyOnPress={false} when it has a return path that neither calls an action that sets the form's isLoading nor navigates away.
    • Why: usePressLoading keeps the spinner until isLoading turns true or the screen regains focus, so that path spins forever.
    • Offending code: BaseOnboardingWorkEmail.tsx:243-247

    Next Steps: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.


    view run

  10. self-assigned this
    on Oct 15, 2026
  11. hungvu193 commented on Oct 15, 2026

    @hungvu193
    Contributor

    on it

  12. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Oct 15, 2026
  13. changed the title [-]Onboarding - Add work email button loads infinitely after returning from magic code & readding[/-] [+][Due for payment 2026-10-23] Onboarding - Add work email button loads infinitely after returning from magic code & readding[/+] on Oct 16, 2026
  14. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    @abzokhattab

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.12-1 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 2026-10-23. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  15. added
    Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.
    on Oct 16, 2026
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.DailyKSv2EngineeringSkip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions