Skip to content

[Due for payment 2026-07-03] [$250] Onboarding - Not here page appears briefly after completing onboarding #91437

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: 9.3.79-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/test-runs/TR-32100/folder/13176924/43449388/1432273397?sort=-identifier
Email or phone of affected tester (no customers): soijdnoisdjoijsdionsjio@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a workspace.
  3. Go to workspace settings > More features.
  4. Enable Rules.
  5. Upgrade workspace to enable Rules.
  6. Go to Rules.
  7. Refresh the page.
  8. Go to Account > Sign out.
  9. Log in with a new Gmail account.
  10. Complete onboarding with Manage my team's expenses intent.

Expected Result:

Not here page will not appear after completing onboarding.

Actual Result:

Not here page appears briefly after completing onboarding.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7160723_1779459240925.12.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7160723

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

Activity

  1. applause-bot commented on May 22, 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/00027c9cd077806154bdee891d4cea6645aeabfef6caf0fb500dbf4fddd50ecc

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 22, 2026
  3. MelvinBot commented on May 22, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When onboarding completes, completeOnboarding optimistically sets hasCompletedGuidedSetupFlow: true, which immediately unmounts the OnboardingModalNavigator from AuthScreens. However, the actual navigation to the target report is deferred via setNavigationActionToMicrotaskQueue (microtask + requestAnimationFrame), creating a multi-frame gap.

    During this gap, the onboarding modal is gone but the deferred navigation hasn't fired yet. On small screens, the modal unmount redirects to HOME, and the underlying route briefly resolves to a report screen where the report data may not be available yet. The ReportNotFoundGuard evaluates shouldShowNotFoundPage as true during this transient window (loading flags are already false but the report hasn't been hydrated), causing the "Hmm... it's not here" flash.

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

    In navigateAfterOnboarding.ts, the dismissModal() call at line 115 fires immediately while the navigation is deferred. The fix should ensure the navigation to the target report happens atomically with (or before) the modal dismissal, eliminating the transient state where no valid route is active. One approach: instead of calling dismissModal() followed by a deferred navigate(), use Navigation.navigateWithinRootNavigator() (or equivalent) that replaces the onboarding modal route with the target report route in a single navigation action, avoiding the gap entirely.

    Alternatively, the ReportNotFoundGuard could be made aware of the onboarding-completion transition (e.g., by checking an isOnboardingTransitioning flag) and suppress the not-found page during this brief window.

    What alternative solutions did you explore? (Optional)

    Adding a loading/splash screen during the transition was considered, but it would add visual noise. The root issue is the two-step dismiss-then-navigate pattern creating a gap -- fixing the navigation to be atomic is cleaner.

    Investigation details

    Key code flow:

    1. User completes onboarding → completeOnboarding() fires
    2. Optimistic data sets hasCompletedGuidedSetupFlow: true in ReportUtils.ts:12005-12011
    3. React re-renders → OnboardingModalNavigator unmounts from AuthScreens.tsx:328
    4. dismissModal() fires immediately at navigateAfterOnboarding.ts:115
    5. Navigation deferred via Promise.resolve().then(requestAnimationFrame(...)) at setNavigationActionToMicrotaskQueue.ts:6-12
    6. During the gap, ReportNotFoundGuard evaluates shouldShowNotFoundPage as true → flash

    Possibly related open 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 May 22, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 22, 2026
  6. Abdukhamid000 commented on May 22, 2026

    @Abdukhamid000
    Contributor

    Proposal

    What is the root cause of that problem?

    After sign-out the URL stays at the previous session's workspace settings path (e.g. /workspace/{OLD_POLICY_ID}/rules). When the new user logs in, AccessOrNotFoundWrapper mounts against that stale path, sees a policy the new account can't access, and renders NotFoundPage for a moment before onboarding redirects them.

    The relevant gate is in [AccessOrNotFoundWrapper.tsx:166-183](https://github.com/Expensify/App/blob/main/src/pages/workspace/AccessOrNotFoundWrapper.tsx#L166-L183):

    const isPolicyEmpty = !Object.entries(policy ?? {}).length || !policy?.id;
    const shouldShowFullScreenLoadingIndicator = !isMoneyRequest && (isLoadingReportData !== false || !!policy?.isLoading) && isPolicyEmpty;
    ...
    const isPolicyNotAccessible = !isPolicyAccessible(policy, login);
    const shouldShowNotFoundPage = (!isMoneyRequest && !isFromGlobalCreate && isPolicyNotAccessible) || !isPageAccessible || shouldBeBlocked;

    Walking the repro:

    1. Old session URL: /workspace/{OLD_POLICY_ID}/rules. Sign out, sign in as new user.
    2. OpenApp runs, IS_LOADING_REPORT_DATA flips from true → false before the onboarding flow has had a chance to redirect.
    3. The new user genuinely doesn't have OLD_POLICY_ID in their policies collection, so policy stays empty. isPolicyEmpty = true.
    4. But isLoadingReportData === false now, so shouldShowFullScreenLoadingIndicator is false.
    5. isPolicyAccessible(policy, login) returns false (empty policy + login mismatch), so shouldShowNotFoundPage is true → NotFoundPage renders.
    6. A tick later the onboarding flow creates the new workspace and OnboardingGuard navigates away → "Not here" disappears.

    The gate doesn't know about onboarding state. We already track it via hasCompletedGuidedSetupFlowSelector(NVP_ONBOARDING) ([selectors/Onboarding.ts:12-23](https://github.com/Expensify/App/blob/main/src/selectors/Onboarding.ts#L12-L23)), but AccessOrNotFoundWrapper doesn't read it — so it makes the "not found" decision in a window where onboarding hasn't run yet.

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

    Hold the loading indicator while onboarding is still in flight, so the "Not here" decision is deferred until either the user is past onboarding or the route is genuinely unreachable:

    +import {hasCompletedGuidedSetupFlowSelector} from '@selectors/Onboarding';
    @@
     const [isLoadingReportData = true] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
    +const [isOnboardingCompleted] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasCompletedGuidedSetupFlowSelector});
    @@
    -const shouldShowFullScreenLoadingIndicator = !isMoneyRequest && (isLoadingReportData !== false || !!policy?.isLoading) && isPolicyEmpty;
    +const shouldShowFullScreenLoadingIndicator =
    +    !isMoneyRequest &&
    +    (isLoadingReportData !== false || !!policy?.isLoading || isOnboardingCompleted === false) &&
    +    isPolicyEmpty;

    isOnboardingCompleted === false is intentionally strict — undefined (not yet hydrated) and true both fall through to the original behavior, so existing flows are unaffected. Only the brief "new user with a stale workspace URL, onboarding still mid-flight" window changes: it shows the spinner instead of "Not here," and then onboarding redirects normally.

    What alternative solutions did you explore?

    • Reset the URL to / on sign-out. Fixes the symptom but also discards legitimately reusable deep links (e.g. signing back in with the same account on the same workspace page should return there). Too broad.
    • Block NotFoundPage rendering with a delay/timeout (useDelayedRender). Hides the flash but is timing-dependent and would still leak on slow networks. Gating on the actual onboarding signal is deterministic.
    • Have OnboardingGuard redirect off workspace routes before AccessOrNotFoundWrapper mounts. Cleaner architecturally, but the guard's redirect path runs through React Navigation's queue and races the wrapper's first render — we'd be solving the same race in a different file. The one-liner in the wrapper is where the decision is actually made.
  7. MobileMage commented on May 22, 2026

    @MobileMage
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-05-22 14:45:39 UTC.

    Proposal

    What is the root cause of that problem?

    Navigation.navigate('/workspaces/<oldPolicyID>/rules', ...) fires for the new account during onboarding completion. That mounts WORKSPACE_NAVIGATOR, AccessOrNotFoundWrapper computes isPolicyAccessible(policy, login) === false for the new user, NotFoundPage renders, and a frame later the post-onboarding navigate to admins chat replaces it. That gap is the flash.

    const isPolicyNotAccessible = !isPolicyAccessible(policy, login);
    // Gate on `isFocused || isWorkspacesTabFocused` so the fallback renders for both
    // - non-workspace consumers of this wrapper (IOU create routes, etc.) where `isFocused` is the meaningful signal, and
    // - workspace central-pane usages where an RHP overlay makes `isFocused` false but the Workspaces tab is still active.
    const shouldShowNotFoundPage =
    (isFocused || isWorkspacesTabFocused) && ((!isMoneyRequest && !isFromGlobalCreate && isPolicyNotAccessible) || !isPageAccessible || !hasAccessToPolicyFeature || shouldBeBlocked);

    Two pieces collide:

    1. On web, react-native-web caches Linking.getInitialURL() once at JS bundle load into a module-scoped constant:

      var initialURL = canUseDOM ? window.location.href : '';

      After signing out and back in within the same tab, Linking.getInitialURL() still returns the previous session's URL.

    2. DeepLinkHandler's effect re-runs on session metadata change, so it re-runs right after sign-out. On that run hasAuthToken() returns false, and it calls openReportFromDeepLink(staleUrl, isAuthenticated=false, ...) at the line below. That captures both in closure and queues an Onyx.connectWithoutView subscription via waitForUserSignIn().then(...).

    openReportFromDeepLink(url, allReports, isCurrentlyAuthenticated, conciergeReportID, introSelected, isSelfTourViewed, betas);

    On the next sign-in, NVP_ONBOARDING changes (either via onboarding completion for a new user, or via initial hydration for an existing user where hasCompletedGuidedSetupFlow is already true). The deferred subscription's callback runs handleDeeplinkNavigation. The if (isAuthenticated) return; bail does not trip because the closure captured false:

    // Navigation for signed users is handled by react-navigation.
    if (isAuthenticated) {
    return;
    }

    Navigation.navigate(route) then fires with the stale workspace URL:

    Navigation.navigate(route as Route, {forceReplace});

    I confirmed this locally by instrumenting handleDeeplinkNavigation. The post-sign-out subscription fires with isAuthenticatedClosure: false, focused route Home, and the navigate to the stale workspace URL goes through. The nav-state dump at that moment shows a second TabNavigator pushed onto the root stack with params.path === "/workspaces/<id>/rules" baked in, which is the signature React Navigation produces from getStateFromPath(URL_STRING). The variant in your follow-up video hits the same path, fired on sign-in rather than after onboarding completion.

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

    Inside the Linking.getInitialURL().then(...) callback below, add an early return when the user is signed out AND initialUrlProcessed.current is already true:

    .then((url) => {
    if (cancelled) {
    return;
    }
    initialUrlProcessed.current = true;
    onInitialUrl(url as Route);
    if (url) {
    if (conciergeReportID === undefined) {
    Log.info('[Deep link] conciergeReportID is undefined when processing initial URL', false, {url});
    }
    if (introSelected === undefined) {
    Log.info('[Deep link] introSelected is undefined when processing initial URL', false, {url});
    }
    // Use hasAuthToken() for the latest auth state at call time, since the isAuthenticated
    // closure value may be stale on cold start (useOnyx reports 'loaded' before storage completes).
    const isCurrentlyAuthenticated = hasAuthToken();
    openReportFromDeepLink(url, allReports, isCurrentlyAuthenticated, conciergeReportID, introSelected, isSelfTourViewed, betas);
    } else {
    Report.doneCheckingPublicRoom();
    }
    endSpan(CONST.TELEMETRY.SPAN_BOOTSPLASH.DEEP_LINK);

    if (!isCurrentlyAuthenticated && initialUrlProcessed.current) {
        return;
    }

    That blocks the post-sign-out openReportFromDeepLink call (the one that captures isAuthenticated=false in closure and queues the stale navigation for the next sign-in), without affecting the legit signed-out-first-time deep-link flow (which has initialUrlProcessed.current === false on its first run and still sets up its subscription as today).

    I applied this guard on top of main locally and confirmed the flash is gone: URL goes from /onboarding/interested-features straight to /home with no intermediate workspace path and no NotFoundPage.

    What alternative solutions did you explore? (Optional)

    • Reset the navigation stack on sign-out in NavigationRoot's logout effect (my previous proposal). You tested it and it did not resolve the flash. The state-dump trace shows the stale route does not survive in rootState.routes through to onboarding completion anyway.

      useEffect(() => {
      // Since the NAVIGATORS.REPORTS_SPLIT_NAVIGATOR url is "/" and it has to be used as an URL for SignInPage,
      // this navigator should be the only one in the navigation state after logout.
      const hasUserLoggedOut = !authenticated && !!previousAuthenticated;
      if (!hasUserLoggedOut || !navigationRef.isReady()) {
      return;
      }
      const rootState = navigationRef.getRootState();
      const lastRoute = rootState.routes.at(-1);
      if (!lastRoute) {
      return;
      }
      // REPORTS_SPLIT_NAVIGATOR will persist after user logout, because it is used both for logged-in and logged-out users
      // That's why for ReportsSplit we need to explicitly clear params when resetting navigation state,
      // However in case other routes (related to login/logout) appear in nav state, then we want to preserve params for those
      const isReportSplitNavigatorMounted = lastRoute.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR;
      navigationRef.reset({
      ...rootState,
      index: 0,
      routes: [
      {
      ...lastRoute,
      params: isReportSplitNavigatorMounted ? undefined : lastRoute.params,
      },
      ],
      });
      }, [authenticated, previousAuthenticated]);

    • Override Linking.getInitialURL on sign-out to return the current window.location.href. Works, but reaches into a third-party module's behavior from outside our codebase.

    • Disconnect the in-flight Onyx subscription from cleanupSession. Workable, but openReportFromDeepLink creates the connection inside a waitForUserSignIn().then(...) callback, so the ref has to be plumbed back out.

      function cleanupSession() {
      Pusher.disconnect();
      Timers.clearAll();
      Welcome.resetAllChecks();
      MainQueue.clear();
      HttpUtils.cancelPendingRequests();
      PersistedRequests.clear();
      SessionUtils.resetDidUserLogInDuringSession();
      resetNavigationState();
      clearCache().then(() => {
      Log.info('Cleared all cache data', true, {}, true);
      });
      clearCachedAttachments();
      clearSoundAssetsCache();
      }

    • Bail inside handleDeeplinkNavigation when route is a workspace URL the current user lacks access to. Tighter, but validates the destination instead of stopping the stale queue at the source.

  8. yusufdeveloper2903 commented on May 22, 2026

    @yusufdeveloper2903
    Contributor

    Proposal

    What is the root cause of that problem?

    During onboarding completion, the app briefly navigates to a "Not here" (404/not-found) page before the correct post-onboarding route is resolved. This happens because the onboarding navigation logic redirects the user before Onyx has fully hydrated the session/onboarding state, causing the router to momentarily render the fallback "not found" screen.

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

    I'd look at src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts and the onboarding redirect logic in src/libs/actions/Welcome.ts (or similar). The fix should guard the redirect so it only fires when the required Onyx keys are ready.

    In the navigation guard / redirect logic (likely in src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts or the useOnboardingFlowRouter hook):

    - if (isOnboardingCompleted) {
    + if (isOnboardingCompleted && !isLoadingOnyxValue(onboardingPurposeSelected)) {
        Navigation.navigate(ROUTES.HOME);
      }

    Additionally, I'd add a loading check before rendering the not-found screen so it only renders once the session and onboarding states are confirmed as loaded:

    - if (!isValidRoute) {
    + if (!isValidRoute && !isLoadingSession && !isLoadingOnboarding) {
        return <NotFoundPage />;
      }

    This ensures the "Not here" page is never shown while Onyx is still hydrating post-onboarding state.

    What alternative solutions did you explore?

    An alternative would be to add a small artificial delay before the redirect, but that is hacky and unreliable across devices. The proper fix is a data-readiness guard.

  9. melvin-bot commented on May 22, 2026

    @melvin-bot

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

  10. changed the title [-]Onboarding - Not here page appears briefly after completing onboarding[/-] [+][$250] Onboarding - Not here page appears briefly after completing onboarding[/+] on May 22, 2026
  11. melvin-bot commented on May 22, 2026

    @melvin-bot
  12. lxyct825-ops commented on May 22, 2026

    @lxyct825-ops

    Proposal

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

    [$250] Onboarding - Not here page appears briefly after completing onboarding

    This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.

    What is the root cause of that problem?

    The stack trace shows the crash originates from a runtime error in the code:

    (See Sentry issue for full stack trace)
    

    The root cause is that the application code at the crash site does not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.

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

    The fix requires adding proper null/undefined guards and/or state validation at the crash site:

    1. Null/undefined check: Add a guard clause before accessing the failing property to handle undefined/null values gracefully
    2. Optional chaining: Use ?. operator where applicable to safely access nested properties
    3. Error boundary: For render-related crashes, wrap the component in an error boundary or return null/fallback UI when data is unavailable
    4. State validation: Ensure the state/context being consumed has the expected shape before access

    The exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.

    What alternative solutions did you explore? (Optional)

    Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.

  13. 49 remaining items

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jun 27, 2026
  15. melvin-bot commented on Jul 2, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. mallenexpensify commented on Jul 6, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @MobileMage paid $250 via Upwork
    Contributor+: @dmkt9 paid $250 via Upwork.

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.

    https://www.upwork.com/jobs/~022074232806999621694

    ^ Test case created. Thx

  17. dmkt9 commented on Jul 7, 2026

    @dmkt9
    Contributor

    Contributor+: @dmkt9 due $250 via Upwork.

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.

    @mallenexpensify Thanks. I've accepted the offer

  18. mallenexpensify commented on Jul 7, 2026

    @mallenexpensify
    Contributor

    @dmkt9 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