Skip to content

[$250] Web - Onboarding - User stuck in Onboarding loop #86586

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.3.50-2
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/folder/13176677/test-cases/41236548
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Exploratory - Critical User Impact
Device used: Windows 11, Chrome
App Component: Other

Action Performed:

Precondition:

  • The user is signed in on ND.
  • The user is not signed in on OD.
  1. Go to https://staging.new.expensify.com/
  2. Open a new tab and navigate to https://staging.expensify.com/
  3. In the ND tab, sign out (do not close the tab).
  4. In the OD tab, select the radio button 'Manage expenses for 10+ employees', enter an email address, and sign up.
  5. Skip the 'What's your work email' modal > 51-100 employees > QBD > Continue

Expected Result:

After completing the onboarding steps, the user should exit the flow and be redirected to the main application without being forced back into onboarding.

Actual Result:

The user remains trapped in the onboarding flow, repeatedly redirected through the same steps without being able to proceed to the main application.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mananjadhav
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022043624323600678650
  • Upwork Job ID: 2043624323600678650
  • Last Price Increase: 2026-05-11

Activity

  1. wildan-m commented on Mar 28, 2026

    @wildan-m
    Contributor

    Proposal for #86586 - Web - Onboarding - User stuck in Onboarding loop

    What is the root cause of that problem?

    When an OD-originated SMB user reaches NewDot, the server returns NVP_ONBOARDING with signupQualifier: "SMB" and hasCompletedGuidedSetupFlow: false. The OnboardingGuard redirects them into the NewDot onboarding flow (Employees → Accounting → InterestedFeatures → PersonalDetails).

    At the end of the flow, BaseOnboardingPersonalDetails calls completeOnboardingReport, which calls prepareOnboardingOnyxData. For the MANAGE_TEAM engagement choice (auto-set for SMB users), shouldPostTasksInAdminsRoom is true, so the function needs an adminsChatReportID to determine the target chat report.

    The adminsChatReportID is set on the Accounting page via a useEffect that reads paidGroupPolicy.chatReportIDAdmins. For OD-originated users, the workspace was created on OldDot and chatReportIDAdmins may not be populated when NewDot loads the policy data. When it's undefined, setOnboardingAdminsChatReportID(undefined) stores null via the ?? null coercion.

    In prepareOnboardingOnyxData, when adminsChatReportID is null:

    1. adminsChatReport = allReports?.["report_null"] → undefined
    2. The fallback object {reportID: null, policyID: ...} is used
    3. Destructuring {reportID: targetChatReportID = ''} gives null (not '', because JS destructuring defaults only apply to undefined, not null)
    4. !targetChatReportID → !null → true → function returns undefined silently

    Since prepareOnboardingOnyxData returns undefined, completeOnboarding returns early without calling the CompleteGuidedSetup API. hasCompletedGuidedSetupFlow stays false. But navigateAfterOnboardingWithMicrotaskQueue fires regardless (it's not gated on the completion result), attempting to navigate to HOME. The OnboardingGuard intercepts this navigation (since isOnboardingCompleted is still false) and redirects back to onboarding → infinite loop.

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

    In prepareOnboardingOnyxData, guard the shouldPostTasksInAdminsRoom branch so it only takes effect when adminsChatReportID is also truthy. When adminsChatReportID is missing, fall back to the Concierge chat report (the same report used for non-team-management flows) instead of constructing a placeholder object with a null reportID. This ensures targetChatReportID is always a valid string, so the early-return guard (!targetChatReportID) never fires, and CompleteGuidedSetup is called — setting hasCompletedGuidedSetupFlow to true and breaking the loop.

    Compare link: main...wildan-m:App:wildan-m/fix-86586-onboarding-loop

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed on Apr 13, 2026
  3. MelvinBot commented on Apr 13, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When an OD-originated SMB user reaches NewDot, their workspace was created on OldDot and chatReportIDAdmins may not be populated on the policy object. This triggers a chain of failures:

    1. BaseOnboardingAccounting.tsx:127 calls setOnboardingAdminsChatReportID(undefined) because paidGroupPolicy.chatReportIDAdmins is undefined.
    2. Welcome/index.ts:57 coerces undefined to null via ?? null and stores it in Onyx.
    3. In ReportUtils.ts:11775-11778, since shouldPostTasksInAdminsRoom is true (SMB users get MANAGE_TEAM), the admins branch constructs a fallback {reportID: null}.
    4. JS destructuring default (= '') doesn't apply to null (only to undefined), so targetChatReportID is null.
    5. !null is true → prepareOnboardingOnyxData returns undefined at line 11781.
    6. completeOnboarding (Report/index.ts:5055-5071) returns early — CompleteGuidedSetup API is never called, so hasCompletedGuidedSetupFlow stays false.
    7. navigateAfterOnboardingWithMicrotaskQueue fires unconditionally (BaseOnboardingPersonalDetails.tsx:99-107), but OnboardingGuard redirects back → infinite loop.

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

    In prepareOnboardingOnyxData (ReportUtils.ts:11775), guard the shouldPostTasksInAdminsRoom ternary so it only takes the admins-room branch when adminsChatReportID is also truthy. When it's missing, fall back to the Concierge chat report instead of constructing a broken placeholder. This ensures targetChatReportID is always a valid string, CompleteGuidedSetup is called, and the loop is broken.

    What alternative solutions did you explore? (Optional)

    1. Await completeOnboardingReport before navigating — would prevent the loop symptom but doesn't fix the root cause (the API call still wouldn't fire).
    2. Fix the ?? null coercion to keep undefined — would let the destructuring default work, but a null-vs-undefined semantic fix is fragile. Better to handle the missing ID explicitly.
    Related issues

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 13, 2026
  5. 32 remaining items

  6. mvtglobally commented on May 2, 2026

    @mvtglobally

    Issue not reproducible during KI retests. (Second week)

  7. mananjadhav commented on May 3, 2026

    @mananjadhav
    Collaborator

    @mvtglobally Can we close this issue?

  8. melvin-bot commented on May 4, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  9. melvin-bot commented on May 7, 2026

    @melvin-bot

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

  10. mvtglobally commented on May 9, 2026

    @mvtglobally

    Issue not reproducible during KI retests. (Third week)

  11. mananjadhav commented on May 10, 2026

    @mananjadhav
    Collaborator

    @mvtglobally Can we please close this issue?

  12. melvin-bot commented on May 11, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  13. melvin-bot commented on May 13, 2026

    @melvin-bot

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

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions