Skip to content

[Due for payment 2026-08-06] [$250] After signing in with a new account, the home page appears instead of the room #85242

Closed

Description

@nlemma

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.3.37-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://github.com/Expensify/Expensify/issues/441896
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: macOS Sequoia 15.4.1
App Component: Other

Action Performed:

  1. Go to https://staging.new.expensify.com
  2. Log out if you're signed in
  3. Go to https://staging.new.expensify.com/r/7075912447943023
  4. Click 'Sign in'
  5. Enter a new email id and log in as a new account
  6. Select any option and complete the flow

Expected Result:

Verify that the loading is complete and the app is responsive.
Verify that you are at the initially opened report

Actual Result:

After signing in with a new account, the home page appears instead of the room

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7086700_1771913817839.1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @KJ21-ENG
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022032475762163410565
  • Upwork Job ID: 2032475762163410565
  • Last Price Increase: 2026-03-13
  • Automatic offers:
    • FitseTLT | Contributor | 110953193

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 13, 2026
  2. MelvinBot commented on Mar 13, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When an unauthenticated user visits a direct report URL (e.g., /r/7075912447943023), clicks "Sign in", and creates a new account, they end up on the home page instead of the originally requested report room.

    What is the root cause of that problem?

    There are two independent mechanisms that together cause the deep link to be lost for new users:

    1. Deep link navigation only fires for anonymous users

    In src/libs/actions/Link.ts:369, handleDeeplinkNavigation() — the function responsible for actually calling Navigation.navigate(route) to the deep-linked report — is gated behind isAnonymousUser():

    if (isAnonymousUser()) {
        handleDeeplinkNavigation();
    }

    A newly signed-up user is not anonymous, so this navigation never fires. The comment at line 322 says "Navigation for signed users is handled by react-navigation", but React Navigation only processes the browser URL on first mount and does not re-process it after authentication state changes.

    2. navigateAfterOnboarding has zero awareness of deep links

    In src/libs/navigateAfterOnboarding.ts:70-74, when a new user completes onboarding, the app navigates to either an onboarding-related report (admin chat) or ROUTES.HOME:

    if (reportID) {
        Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID));
    } else {
        Navigation.navigate(ROUTES.HOME);
    }

    It has no parameter, no reference, and no mechanism to check for a pending deep link. Additionally, the OnboardingGuard intercepts all navigation for new users and redirects to onboarding before any deep link navigation could occur.

    Meanwhile, AuthScreensInitHandler (src/libs/Navigation/AppNavigator/AuthScreensInitHandler.tsx:122-128) correctly extracts the reportID from the initial URL and calls Report.openReport() to fetch the report data — but it does not navigate to it.

    The InitialURLContextProvider stores the deep link URL in React state and this data does survive through sign-in and onboarding — it just is never consumed for navigation.

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

    Modify navigateAfterOnboarding to check for a pending deep link before defaulting to HOME. The callers of navigateAfterOnboardingWithMicrotaskQueue are all React components (e.g., BaseOnboardingPersonalDetails, BaseOnboardingWorkspaces) that have access to the InitialURLContext via the useInitialURLState hook. The approach:

    1. Add an optional initialURL parameter to navigateAfterOnboarding and navigateAfterOnboardingWithMicrotaskQueue.
    2. In each onboarding completion page that calls navigateAfterOnboardingWithMicrotaskQueue, read initialURL from useInitialURLState() and pass it through.
    3. In navigateAfterOnboarding, before the fallback Navigation.navigate(ROUTES.HOME), check if initialURL contains a valid report route (using getReportIDFromLink). If it does, navigate to that report instead of HOME.
    4. After consuming the deep link, clear it via setInitialURL(null) from useInitialURLActions() to prevent reuse.

    What alternative solutions did you explore? (Optional)

    • Storing the deep link in Onyx: This would allow navigateAfterOnboarding (a plain function) to read it without receiving it as a parameter. However, adding a new Onyx key just for this seems heavier than passing the already-available context value through function parameters.
    • Fixing the isAnonymousUser() gate in Link.ts: Removing the anonymous-user-only condition at line 369 could allow deep link navigation for signed-in users. However, this is risky because the handleDeeplinkNavigation closure captures a stale isAuthenticated=false value, and the OnboardingGuard would still intercept navigation for new users before onboarding completes. Fixing just Link.ts wouldn't solve the problem for new users going through onboarding.

    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.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 13, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 13, 2026
  5. melvin-bot commented on Mar 13, 2026

    @melvin-bot

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

  6. changed the title [-]After signing in with a new account, the home page appears instead of the room[/-] [+][$250] After signing in with a new account, the home page appears instead of the room[/+] on Mar 13, 2026
  7. melvin-bot commented on Mar 13, 2026

    @melvin-bot
  8. dassoft-official commented on Mar 13, 2026

    @dassoft-official

    Proposal

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

    When an unauthenticated user visits a direct report URL (e.g., /r/7075912447943023), clicks "Sign up", and creates a new account, they end up on the home page after completing onboarding instead of the originally requested report room. This results in a broken user experience where the context of their entry into the app is lost immediately after they finish setting up their account.

    What is the root cause of that problem?

    The "loss" of the deep link happens because of a disconnect between how the app captures URLs and how it manages navigation after a user authenticates and onboards.

    1. Captured but not Consumed: The InitialURLContextProvider correctly captures the deep link URL (e.g., via Linking.getInitialURL()) and stores it in context. This context stays alive through the sign-up process.
    2. Gated Early Navigation: In src/libs/actions/Link.ts, the logic that actually performs the navigation to a captured deep link is restricted to anonymous users:
      if (isAnonymousUser()) {
          handleDeeplinkNavigation();
      }
      A user who has just signed up is no longer "anonymous," so this code block is bypassed.
    3. Onboarding Stack Reset: Even if the navigation fired earlier, the onboarding flow is a separate navigator stack. When it completes, the function navigateAfterOnboarding() is called to "clean up" and send the user to the main app. This function currently defaults to ROUTES.HOME (or an admins room if a workspace was created), completely ignoring the InitialURLContext.

    In summary: The data is there, but nothing is looking at it when the user finally enters the "real" app.


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

    We propose modifying the post-onboarding navigation function to prioritize any pending deep link. This ensures the user lands exactly where they intended to go.

    1. Enhance navigateAfterOnboarding

    Modify src/libs/navigateAfterOnboarding.ts to accept the initialURL and a callback to clear it. We will use getReportIDFromLink to see if the URL points to a valid report.

    function navigateAfterOnboarding(
        // parameters
        initialURL?: string | null,
        setInitialURL?: (url: string | null) => void,
    ) {
        setDisableDismissOnEscape(false);
    
        // 1. Check for Deep Link Presence
        const reportID = getReportIDFromLink(initialURL ?? '');
        
        // 2. If it is a valid report link, go there and clear the context
        if (reportID) {
            Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID));
            setInitialURL?.(null);
            return;
        }
    
        // ... fall back to existing logic (Admins room or HOME)
    }

    2. Connect Onboarding Screens to InitialURLContext

    Update the "Exit" screens of the onboarding flow (where navigateAfterOnboarding is called) to fetch this data from context.

    Affected files include BaseOnboardingPersonalDetails.tsx, BaseOnboardingInterestedFeatures.tsx, etc.

    // Inside the component:
    const {initialURL} = useInitialURLState();
    const {setInitialURL} = useInitialURLActions();
    
    // On completion:
    navigateAfterOnboarding(
        // ...
        initialURL,
        setInitialURL,
    );

    What alternative solutions did you explore?

    Alternative 1: Storing Deep Link in Onyx

    Instead of passing context through the navigation function, we could store the initialURL in a persistent Onyx key (e.g., ONYXKEYS.PENDING_DEEP_LINK).

    • Pros: Works even if the app process is killed and restarted mid-onboarding.
    • Cons: Overkill for many flows. Requires manual cleanup logic in multiple places to avoid "stale" deep links firing days later. Adds more "state" to the already complex Onyx store.

    Alternative 2: Removing the isAnonymousUser() gate in Link.ts

    We could allow handleDeeplinkNavigation() to fire for authenticated users as well.

    • Pros: Centralizes navigation logic in one file.
    • Cons: High Risk. Link.ts often executes early in the boot cycle. If it fires while the user is still in the "Onboarding Navigator," it will fail because the main App navigator isn't mounted yet. If we force it to wait, we risk clashing with the onboarding flow's own exit navigation, creating race conditions where the user is flickered between Home and the Report room.

    Comparison Table

    Feature Proposed (Context Passing) Alternative 1 (Onyx) Alternative 2 (Link.ts Gate)
    Simplicity High (uses existing hooks) Medium High
    Reliability High (controlled exit) High (persistent) Low (race conditions)
    Code Impact Low (only exit points) Medium (new Onyx key) Low
    Safe for Onboarding Yes Yes No

    Recommendation: The Proposed Solution (Context Passing) is the safest and most efficient. It ensures that the transition only happens when the user has "successfully" left the onboarding flow, providing a seamless and intentional "landing" experience.

  9. melvin-bot commented on Mar 13, 2026

    @melvin-bot

    📣 @moinshahryar-eng! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  10. github-actions commented on Mar 13, 2026

    @github-actions
    Contributor

    ⚠️ @jainam884 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  11. ProjectNOVACo commented on Mar 13, 2026

    @ProjectNOVACo

    Proposal

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

    When an unauthenticated user visits a direct report URL (e.g., /r/7075912447943023), signs in or creates a new account, and completes onboarding, they are taken to the home page instead of the originally requested report room.

    What is the root cause of that problem?

    The deep link URL survives through authentication and onboarding in the InitialURLContext React state, but no code path consumes it for post-onboarding navigation. Two independent mechanisms combine to drop the deep link:

    1. Deep link navigation is gated behind isAnonymousUser() (Link.ts:369):

    In openReportFromDeepLink() (src/libs/actions/Link.ts:369), the actual navigation call handleDeeplinkNavigation() only fires for anonymous users:

    if (isAnonymousUser()) {
        handleDeeplinkNavigation();
    }

    A user who just signed up is authenticated (not anonymous), so the navigation is never executed. The comment at line 322 says "Navigation for signed users is handled by react-navigation," but React Navigation only processes the browser URL on first mount and does not re-evaluate it after auth state changes.

    Additionally, at line 323, isAuthenticated causes an early return for signed-in users:

    if (isAuthenticated) {
        return;
    }

    This means even if we removed the isAnonymousUser() gate, the navigateHandler() closure would never be reached for authenticated users.

    2. navigateAfterOnboarding() has no awareness of pending deep links (navigateAfterOnboarding.ts:45-76):

    When onboarding completes, all 5 exit screens (BaseOnboardingPersonalDetails, BaseOnboardingWorkspaces, BaseOnboardingWorkspaceOptional, BaseOnboardingWorkspaceInvite, BaseOnboardingInterestedFeatures) call navigateAfterOnboardingWithMicrotaskQueue(). This function computes a destination using getReportIDAfterOnboarding(), which checks for an admin room or the last accessed report, and falls back to ROUTES.HOME. It never checks for a pending deep link URL.

    The InitialURLContextProvider (src/components/InitialURLContextProvider.tsx:34-66) captures the initial URL via Linking.getInitialURL() and stores it in React state. This state persists through sign-in and onboarding. The data is available — it is just never consumed for navigation.

    Full trace:

    1. User visits https://new.expensify.com/r/7075912447943023 while signed out
    2. InitialURLContextProvider stores /r/7075912447943023 in initialURL state
    3. AuthScreensInitHandler (AuthScreensInitHandler.tsx:122-128) extracts the reportID and calls Report.openReport() to fetch data, but does NOT navigate
    4. OnboardingGuard intercepts all navigation and redirects to onboarding
    5. User completes onboarding → navigateAfterOnboardingWithMicrotaskQueue() runs
    6. getReportIDAfterOnboarding() finds admin room or falls back to ROUTES.HOME
    7. initialURL with /r/7075912447943023 remains unconsumed — user lands on HOME

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

    Add initialURL and setInitialURL parameters to navigateAfterOnboarding() and navigateAfterOnboardingWithMicrotaskQueue(), and check for a pending deep link before falling back to HOME.

    1. Modify navigateAfterOnboarding.ts:

    +import {getReportIDFromLink} from ./ReportUtils;
    +import type {Route} from @src/ROUTES;
    +
     function navigateAfterOnboarding(
         isSmallScreenWidth: boolean,
         canUseDefaultRooms: boolean | undefined,
         conciergeReportID: string,
         archivedReportsIdSet: ArchivedReportsIDSet,
         onboardingPolicyID?: string,
         onboardingAdminsChatReportID?: string,
         shouldPreventOpenAdminRoom = false,
    +    initialURL?: Route | null,
    +    setInitialURL?: (url: Route | null) => void,
     ) {
         setDisableDismissOnEscape(false);
     
         if (shouldOpenRHPVariant()) {
             handleRHPVariantNavigation(onboardingPolicyID);
             return;
         }
     
    +    // Check for a pending deep link from before sign-up/sign-in
    +    const deepLinkReportID = getReportIDFromLink(initialURL ?? );
    +    if (deepLinkReportID) {
    +        setInitialURL?.(null);
    +        Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(deepLinkReportID));
    +        return;
    +    }
    +
         const reportID = getReportIDAfterOnboarding(
             isSmallScreenWidth,
             canUseDefaultRooms,

    2. Thread initialURL through navigateAfterOnboardingWithMicrotaskQueue():

     function navigateAfterOnboardingWithMicrotaskQueue(
         isSmallScreenWidth: boolean,
         canUseDefaultRooms: boolean | undefined,
         conciergeReportID: string,
         archivedReportsIdSet: ArchivedReportsIDSet,
         onboardingPolicyID?: string,
         onboardingAdminsChatReportID?: string,
         shouldPreventOpenAdminRoom = false,
    +    initialURL?: Route | null,
    +    setInitialURL?: (url: Route | null) => void,
     ) {
         Navigation.dismissModal();
         Navigation.setNavigationActionToMicrotaskQueue(() => {
             navigateAfterOnboarding(
                 isSmallScreenWidth,
                 canUseDefaultRooms,
                 conciergeReportID,
                 archivedReportsIdSet,
                 onboardingPolicyID,
                 onboardingAdminsChatReportID,
                 shouldPreventOpenAdminRoom,
    +            initialURL,
    +            setInitialURL,
             );
         });
     }

    3. Update all 5 onboarding exit screens to pass initialURL:

    In each of BaseOnboardingPersonalDetails.tsx, BaseOnboardingWorkspaces.tsx, BaseOnboardingWorkspaceOptional.tsx, BaseOnboardingWorkspaceInvite.tsx, and BaseOnboardingInterestedFeatures.tsx:

    +import {useInitialURLState, useInitialURLActions} from @components/InitialURLContextProvider;
    
     function BaseOnboardingXxx(...) {
    +    const {initialURL} = useInitialURLState();
    +    const {setInitialURL} = useInitialURLActions();
    
         // ... existing code ...
    
         navigateAfterOnboardingWithMicrotaskQueue(
             isSmallScreenWidth,
             isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS),
             conciergeChatReportID,
             archivedReportsIdSet,
             onboardingPolicyID,
             onboardingAdminsChatReportID,
             false,
    +        initialURL,
    +        setInitialURL,
         );

    Why this approach is superior to alternatives:

    1. vs. fixing Link.ts isAnonymousUser gate: Removing the anonymous-user-only condition does not work because (a) isAuthenticated causes a separate early return at line 323, (b) the handleDeeplinkNavigation closure captures a stale isAuthenticated=false value, and (c) OnboardingGuard would intercept any navigation attempt before onboarding completes. The deep link would still be dropped.

    2. vs. deferring handler in Link.ts until onboarding closes (jainam884 approach): This requires handleDeeplinkNavigation() to monitor onboarding state via an Onyx subscription, adding coupling between deep-link handling and the onboarding flow. The subscription must be kept alive across potentially minutes of user interaction during onboarding. The proposed approach is simpler — it uses the already-available InitialURLContext and fires at the exact moment onboarding exits.

    3. vs. storing deep link in Onyx: Adding a new Onyx key adds schema complexity and requires cleanup logic to prevent stale deep links from firing in future sessions. The InitialURLContext already stores the URL in React state, which is session-scoped and automatically cleared on page reload.

    Edge cases covered:

    • Non-report deep links (e.g., /settings/profile): getReportIDFromLink() returns empty string for non-report URLs, so the fallback to getReportIDAfterOnboarding() still runs
    • Sub-report routes (e.g., /r/123/details): getReportIDFromLink() returns empty string for sub-report pages, allowing their respective components to handle them
    • No deep link: When initialURL is null, the existing flow (admin room or HOME) proceeds unchanged
    • setInitialURL(null) after consuming: Prevents the deep link from being consumed twice if the user navigates away and triggers another onboarding guard check

    What alternative solutions did you explore? (Optional)

    See "Why this approach is superior" above.

  12. ohrytskov commented on Mar 16, 2026

    @ohrytskov

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  13. 131 remaining items

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed
    ReviewingHas a PR in review
    Awaiting PaymentAuto-added when associated PR is deployed to production
    on Aug 6, 2026
  15. changed the title [-][$250] After signing in with a new account, the home page appears instead of the room[/-] [+][Due for payment 2026-08-06] [$250] After signing in with a new account, the home page appears instead of the room[/+] on Aug 6, 2026
  16. melvin-bot commented on Aug 6, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  17. KJ21-ENG commented on Aug 6, 2026

    @KJ21-ENG
    Contributor

    @mallenexpensify offer accepted. Thanks!

  18. abbasifaizan70 commented on Aug 6, 2026

    @abbasifaizan70
    Contributor

    @mallenexpensify You mentioned me wrong again. 😄

  19. mallenexpensify commented on Aug 6, 2026

    @mallenexpensify
    Contributor

    @abbasifaizan70 apologies for the tag above, GH sux

    Image
  20. mallenexpensify commented on Aug 6, 2026

    @mallenexpensify
    Contributor

    @KJ21-ENG paid, summary updated above. Thx.

  21. FitseTLT commented on Aug 7, 2026

    @FitseTLT
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: https://github.com/Expensify/App/pull/81689/changes#r3736815719

    • [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 — not critical. Sign-in and onboarding both complete successfully; only the deep-linked report is lost, and the user can still reach it via the URL or search.

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

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/669638

    Regression Test Proposal

    Precondition:

    • A public room or chat report URL that a brand-new account is allowed to open (e.g. https://staging.new.expensify.com/r/<reportID>).
    • Email addresses that have never been used to sign in to New Expensify (one per run below).
    • Signed out of New Expensify in the browser.

    Test:

    1. Open https://staging.new.expensify.com/r/<reportID> while signed out.
    2. Click Sign in and sign up with a brand-new account.
    3. Complete onboarding, choosing an option other than "Manage my team's expenses" or "Track expenses for my business".
    4. Verify the app finishes loading, is responsive, and lands on the report from step 1 — not Home.
    5. Repeat steps 1–2 with a new account, choose Track expenses for my business, and verify the report from step 1 is still restored underneath, with Concierge opening on top of it (expected).
    6. Repeat steps 1–2 with a new account, choose Manage my team's expenses, and verify the app opens the workspace #admins room (expected — the report is not restored for this choice).
    7. Sign out and force close the app. Open https://staging.new.expensify.com/concierge while signed out, sign up with a new account and complete onboarding. If the Concierge chat is open afterwards, tap back and verify the app returns to Home and does not freeze.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-7861-ac7f-8d35-f759f3625134
  22. FitseTLT commented on Aug 7, 2026

    @FitseTLT
    Contributor
  23. flaviadefaria commented on Aug 7, 2026

    @flaviadefaria
    Contributor

    Approved: @FitseTLT due $250 via NewDot

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.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions