Skip to content

[Due for payment 2026-08-05] [$250] Web - Email - Member redirects to Home page instead of Workspace chat #94549

Closed

Description

@applause-bot

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.4.19-1
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-48574/folder/13176726/41237087/1515171555?sort=%2Bidentifier
Email or phone of affected tester (no customers): leungbratt6+25064@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10/Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

Setup - Can be executed in a Secondary device or browser

  1. Log in as an admin of a workspace or create one
  2. Enter a custom name for the workspace
  3. Navigate to Account Settings > Workspaces > Your new workspace
  4. In the workspace Settings, click on Members
  5. Click on the Invite Member button
  6. Add an email address that does not have an Expensify account
  7. Click Invite (Should be a real account with an inbox that can receive the invite)

Steps - Main testing device
8. Open the email inbox of the invited user
9. Verify that the new user received an invitation
10. Copy the link at the bottom of the email and change it to staging
11. Verify you do not need to use a magic link
12. Verify that you are redirected to the workspace chat

Expected Result:

Verify that you are redirected to the workspace chat

Actual Result:

Member lands on the Home page

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7190514_1782358334286.email_member.1.mp4

View all open jobs on GitHub

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

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 25, 2026
  2. applause-bot commented on Jun 25, 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/7e7eb55d4753ff53d67671a1f66b04f63de04d33386005dcb684177654db21a5

  3. MelvinBot commented on Jun 25, 2026

    @MelvinBot
    Contributor

    Proposal

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

    A brand-new user who is invited to a workspace by email, then clicks the invite link (which signs them in without a magic link), lands on the Home page instead of being redirected to the workspace chat.

    What is the root cause of that problem?

    The invite email link is an OldDot→NewDot transition link carrying an exitTo query param (the report route to land on). For a logged-out, never-before-seen invitee, the link is handled by the public screen LogInWithShortLivedAuthTokenPage, which signs the user in but does not navigate to exitTo itself — it intentionally delegates that to setUpPoliciesAndNavigate, which runs once when AuthScreens mounts after sign-in.

    setUpPoliciesAndNavigate only performs the redirect when both of these hold:

    • the current URL still contains exitTo — otherwise it returns early at App.ts:838, and
    • the user is not detected as "logging in as a new user" — App.ts:873.

    For the new-invitee flow, the redirect can be skipped because the transition URL/exitTo no longer survives to the single post‑sign‑in pass of setUpPoliciesAndNavigate (the function is designed to run again for new users per its own doc comment at App.ts:819-821, but by then getCurrentUrl() no longer includes exitTo, so it bails). With the redirect skipped, the authenticated user is left on the default landing — Home. Because the symptom is Home (not a "not found"/loading report page), the failure is the redirect never firing, not the target report being fetched too late.

    Investigation details & evidence

    Open question (needs confirmation before implementing): the exitTo value itself is generated by the backend (OldDot/Web-Expensify) when the invite email is built. This analysis assumes that value correctly points at the workspace chat report. If the email link does not carry an exitTo for the workspace chat for never-validated accounts, the fix is backend-side and outside this repo — a separate internal investigation would be needed. To disambiguate, confirm via a repro what URL the staging invite email produces and whether setUpPoliciesAndNavigate sees exitTo on its post-sign-in pass.

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

    Make the exitTo from the transition link survive the new-user sign-in so the post-sign-in pass of setUpPoliciesAndNavigate can still act on it. Concretely: when the public transition page (LogInWithShortLivedAuthTokenPage) signs in a new user, persist the exitTo route (e.g. in Onyx/session) and have setUpPoliciesAndNavigate fall back to that stored value when getCurrentUrl() has already lost the exitTo param, then clear it after navigating. This keeps the redirect working for first-time invitees without changing behavior for existing users.

    This should be confirmed against a real staging repro (and/or logs) first, since the exact failing condition and the backend-supplied exitTo value need to be verified before locking in the implementation.

    Possibly related (not duplicates)


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94549) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 25, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 25, 2026
  6. aswin-s commented on Jun 25, 2026

    @aswin-s
    Contributor

    Proposal

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

    When a new user (with no existing Expensify account) clicks a workspace invite link from their email and completes the onboarding flow on web (large screen), they are redirected to the Home page instead of the workspace chat. The expected behavior is that they land on the workspace chat after completing onboarding.

    What is the root cause of that problem?

    In src/libs/navigateAfterOnboarding.ts, getReportIDAfterOnboarding (lines 41–45) has an early-return for large screens: it returns onboardingAdminsChatReportID if set, or immediately returns undefined otherwise. For a workspace-invited new member, onboardingAdminsChatReportID is undefined (they are not an admin), so the function returns undefined. navigateAfterOnboarding then falls through to Navigation.navigate(ROUTES.HOME) at line 100. The findLastAccessedReport branch that would have caught the workspace chat report is only reached on small screens — it is completely skipped for large screens, leaving invited members stranded on Home.

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

    1. src/libs/navigateAfterOnboarding.ts lines 41–46: Remove the early return undefined on large screens when onboardingAdminsChatReportID is not set. Instead fall through to the findLastAccessedReport logic so that the workspace chat (the last accessed report the invited user was added to) is returned for large screens too.
    2. src/libs/navigateAfterOnboarding.ts lines 48–55: Update the findLastAccessedReport guard condition (lastAccessedReport.policyID !== onboardingPolicyID) to also allow reports matching the inviting policy — currently it excludes the onboarding policy's reports, which may filter out the workspace chat that the invited member should land on. Pass the inviting policyID (distinct from any self-created onboardingPolicyID) or adjust the filter so it does not exclude the target workspace.
    3. Verify that callers of navigateAfterOnboarding / navigateAfterOnboardingWithMicrotaskQueue in BaseOnboardingPersonalDetails, BaseOnboardingPurpose, and BaseOnboardingInterestedFeatures pass the correct onboardingPolicyID value (or undefined) for the invited-member path so the new fallback logic routes to the right report.

    What alternative solutions did you explore? (Optional)

    An alternative is to introduce a dedicated invitingPolicyWorkspaceChatReportID parameter passed from the onboarding screens to navigateAfterOnboarding for the invite-link flow, navigating to it explicitly on completion — more targeted but requires threading the value through more call sites.

  7. MobileMage commented on Jun 25, 2026

    @MobileMage
    Contributor

    Proposal

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

    A user who is invited to a workspace and does not yet have an Expensify account clicks the link at the bottom of the invitation email, gets signed in without needing a magic code, and should land on the workspace chat referenced by the link. Instead, the deep-link target is dropped during the sign-in handoff and the invited member lands on the Home page (the LHN report list root).

    What is the root cause of that problem?

    The invitation link opens a NewDot report deep link (/r/{reportID} for the workspace chat). On web, DeepLinkHandler calls openReportFromDeepLink, which defers navigation until the brand-new account finishes signing in via waitForUserSignIn().then(...). Once signed in, navigation is gated on the user's onboarding state. Both gates that decide whether handleDeeplinkNavigation runs read nvp_onboarding.hasCompletedGuidedSetupFlow, and for an invited member the server sets that flag to false. The entry gate only invokes the navigation when the flag is truthy:

    if (hasCompletedGuidedSetupFlowSelector(val) || isAnonymousUser()) {
        handleDeeplinkNavigation();
    }

    if (hasCompletedGuidedSetupFlowSelector(val) || isAnonymousUser()) {
    handleDeeplinkNavigation();
    }

    hasCompletedGuidedSetupFlowSelector returns the raw false here (it only coerces to true for an empty/undefined NVP), so for an invited member the gate is false and handleDeeplinkNavigation is never called. Even if it were, the #91437 guard inside it drops any link captured pre-onboarding: if (initialHasCompletedGuidedSetupFlow === false) return; (line 348). That guard was added on the assumption that navigateAfterOnboarding owns the post-onboarding destination and will override the deep link anyway.

    That assumption does not hold for invited members. In useOnboardingFlowRouter, an invited/group member (wasInvitedToNewDot or hasNonPersonalPolicy) returns early and the onboarding flow is never started, so navigateAfterOnboarding never runs for them:

    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    const isInvitedOrGroupMember = (hasNonPersonalPolicy || wasInvitedToNewDot) ?? false;
    if (isMigratedUser || isInvitedOrGroupMember) {
    return;
    }

    So for an invited member there is no onboarding flow to take over navigation, and the deep link is the only thing that would route them to the workspace chat — but it gets suppressed because hasCompletedGuidedSetupFlow is false. Nothing else navigates, so they remain on Home. This is distinct from the transition/exitTo path (setUpPoliciesAndNavigate, LogOutPreviousUserPage); the invite email is a plain report deep link that flows through openReportFromDeepLink, where the early return at line 285 means only this function is responsible for the navigation.

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

    Exclude invited members from the onboarding-completion gating in openReportFromDeepLink, because for them the deep link is the sole navigation source and no onboarding flow will ever override it. openReportFromDeepLink already receives introSelected as a parameter, so we can derive wasInvitedToNewDotSelector(introSelected) (which is just introSelected?.inviteType !== undefined) without any new Onyx subscription, and import it alongside the existing hasCompletedGuidedSetupFlowSelector from @src/selectors/Onboarding. We then let invited members through both gates — the entry gate at line 394 and the pre-onboarding drop at line 348:

    const wasInvited = wasInvitedToNewDotSelector(introSelected);
    // at line 348:
    if (initialHasCompletedGuidedSetupFlow === false && !wasInvited) {
        return;
    }
    // at line 394:
    if (hasCompletedGuidedSetupFlowSelector(val) || isAnonymousUser() || wasInvited) {
        handleDeeplinkNavigation();
    }

    // Drop a deep link captured before onboarding finished: navigateAfterOnboarding owns the
    // post-onboarding destination and overrides it anyway, so honoring it only risks the flash (#91437).
    if (initialHasCompletedGuidedSetupFlow === false) {
    return;
    }

    This is safe because it narrows the #91437 fix rather than reverting it: organic fresh sign-ups (no inviteType) still have their pre-onboarding deep link dropped so navigateAfterOnboarding can own the destination and the "Not here" flash is avoided. The change only affects users who were invited, who skip onboarding entirely, and for whom honoring the deep link is exactly the expected behavior described in the issue. navigateHandler still falls back to the last-accessed report or Concierge when the report does not exist, so a stale/inaccessible link cannot strand the user.

    What alternative solutions did you explore? (Optional)

    Routing invited members through the transition/exitTo mechanism in setUpPoliciesAndNavigate was considered, but the invite email is a plain /r/{reportID} deep link with no exitTo query param, so that path returns early at App.ts:838 and never fires — fixing openReportFromDeepLink, where the link is actually handled, is the correct and minimal place.

  8. David-2002065 commented on Jun 25, 2026

    @David-2002065
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-06-25 07:18:26 UTC.

    Proposal

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

    A workspace member who opens the email invite link lands on the Home page instead of being redirected to the workspace chat.

    What is the root cause of that problem?

    The invite link is a validate-login deep link with an exitTo param (/v/<accountID>/<validateCode>?exitTo=<workspaceChat>). On web, ValidateLoginPage registers the deferred destination navigation after sign-in

    if (exitTo && !isSignedIn) {
    handleExitToNavigation(exitTo);
    }

    which runs handleExitToNavigation:
    function handleExitToNavigation(exitTo: Route) {
    waitForUserSignIn().then(() => {
    Navigation.waitForProtectedRoutes().then(() => {
    Navigation.goBack(ROUTES.HOME, {waitForTransition: true});
    Navigation.navigate(exitTo, {waitForTransition: true});
    });
    });
    }

    Navigation.goBack(ROUTES.HOME, {waitForTransition: true});
    Navigation.navigate(exitTo, {waitForTransition: true});
    

    A freshly invited member has not completed guided setup yet, so when the navigate(exitTo) action is dispatched the OnboardingGuard evaluates it. The invited-member skip signals (hasNonPersonalPolicy / wasInvitedToNewDot) are read from module-level Onyx subscriptions that haven't been populated for the just-created account at that instant, so isInvitedOrGroupMember is false

    const isInvitedOrGroupMember = (hasNonPersonalPolicy || wasInvitedToNewDot) ?? false;

    and with onboarding not completed, shouldSkipOnboarding is false, so the guard returns a REDIRECT to the onboarding route and discards the exitTo destination
    const shouldSkipOnboarding =
    skipOnboardingConfig ||
    isLoading ||
    isTransitioning ||
    isOnboardingCompleted ||
    isMigratedUser ||
    isInvitedOrGroupMember ||
    isSingleEntry ||
    isFirstTimeHybridAppTransition ||
    isNavigatingWithReplace;
    if (shouldSkipOnboarding) {
    return {type: 'ALLOW'};
    }
    // If the OnboardingModalNavigator is the currently focused route, the user is already
    // on the onboarding flow. Redirecting again would produce a redundant state reset that
    // triggers further actions, creating an infinite navigation loop (APP-7FR).
    const isOnboardingFocused = state.routes[state.index]?.name === NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR;
    if (isOnboardingFocused) {
    return {type: 'ALLOW'};
    }
    // User needs onboarding - calculate the correct step and redirect
    const onboardingRoute = getOnboardingRoute();
    Log.info('[OnboardingGuard] Redirecting to onboarding route', false, {
    onboardingRoute,
    skipOnboardingConfig,
    isLoading,
    isTransitioning,
    isOnboardingCompleted,
    isMigratedUser,
    isSingleEntry,
    isFirstTimeHybridAppTransition,
    isInvitedOrGroupMember,
    isNavigatingWithReplace,
    });
    return {
    type: 'REDIRECT',
    route: onboardingRoute,
    };

    But during a validate-login flow the OnboardingModalNavigator is intentionally not mounted

    {isOnboardingCompleted === false && !Navigation.isValidateLoginFlow() && (

    so the redirect to the onboarding route silently no-ops, leaving the user on the ROUTES.HOME route that the preceding goBack(ROUTES.HOME) already placed. Net effect: the member lands on Home instead of the workspace chat.

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

    The OnboardingGuard should not hijack a navigation that is part of the validate-login / exitTo deep-link flow, mirroring what AuthScreens already does (it skips mounting the onboarding navigator during Navigation.isValidateLoginFlow()). We add a skip signal to shouldSkipOnboarding

    const shouldSkipOnboarding =
    skipOnboardingConfig ||
    isLoading ||
    isTransitioning ||
    isOnboardingCompleted ||
    isMigratedUser ||
    isInvitedOrGroupMember ||
    isSingleEntry ||
    isFirstTimeHybridAppTransition ||
    isNavigatingWithReplace;

    const isExitToFlow = (context.currentUrl?.includes('exitTo') || Navigation.isValidateLoginFlow()) ?? false;
    
    const shouldSkipOnboarding =
        skipOnboardingConfig ||
        isLoading ||
        isTransitioning ||
        isExitToFlow ||
        isOnboardingCompleted ||
        ...
    

    This lets navigate(exitTo) reach the workspace chat. For not-yet-onboarded invited members, onboarding is still correctly skipped in steady state by useOnboardingFlow (which early-returns for isInvitedOrGroupMember), so no onboarding modal is wrongly shown.

    Alternatively (or additionally), we can fix handleExitToNavigation so it never plants the user on Home: drop the goBack(ROUTES.HOME) and navigate to the destination with forceReplace to replace the consumed /v/ route directly

    function handleExitToNavigation(exitTo: Route) {
    waitForUserSignIn().then(() => {
    Navigation.waitForProtectedRoutes().then(() => {
    Navigation.goBack(ROUTES.HOME, {waitForTransition: true});
    Navigation.navigate(exitTo, {waitForTransition: true});
    });
    });
    }

    Navigation.navigate(exitTo, {forceReplace: true});
    

    Note: the guard skip is still needed so the exitTo navigation isn't redirected to onboarding while the member data is loading.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    In OnboardingGuard.test.ts, add a case where onboarding is not completed and isInvitedOrGroupMember is false but the current URL contains exitTo (validate-login flow): assert the guard returns ALLOW instead of REDIRECT, so the exitTo destination is preserved.

    What alternative solutions did you explore? (Optional)

    We could gate the early-return in OnboardingGuard.evaluate on the focused route being SCREENS.VALIDATE_LOGIN, but handleExitToNavigation calls goBack(ROUTES.HOME) before navigate(exitTo), so the focused route may already be Home by the time the guard runs; keying off the exitTo URL param (as the existing isTransitioning check keys off TRANSITION_BETWEEN_APPS) is more reliable.

  9. melvin-bot commented on Jun 25, 2026

    @melvin-bot

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

  10. changed the title [-]Web - Email - Member redirects to Home page instead of Workspace chat[/-] [+][$250] Web - Email - Member redirects to Home page instead of Workspace chat[/+] on Jun 25, 2026
  11. melvin-bot commented on Jun 25, 2026

    @melvin-bot
  12. neerajbachani commented on Jun 25, 2026

    @neerajbachani
    Contributor

    proposal

  13. 59 remaining items

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Aug 3, 2026
  15. melvin-bot commented on Aug 4, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. melvin-bot commented on Aug 4, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2070041782240135206/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  17. mallenexpensify commented on Aug 7, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @Abdulloh0109 paid $250 via Upwork
    Contributor+: @hoangzinh due $250 via NewDot

    @Abdulloh0109 can you please accept the job below? Please reply here and tag me once you have.
    If you're not sent an offer in Upwork when you're assigned to an issue, please tag me. If an Upwork job exists, please submit a proposal.
    https://www.upwork.com/jobs/~022085549837875469622

  18. laurenreidexpensify commented on Aug 10, 2026

    @laurenreidexpensify
    Contributor

    $250 approved @hoangzinh

  19. mallenexpensify commented on Aug 10, 2026

    @mallenexpensify
    Contributor

    @Abdulloh0109 paid, summary updated above. Thx.

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

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions