You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-07-03] [$250] Onboarding - Not here page appears briefly after completing onboarding #91437
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.
During the gap, ReportNotFoundGuard evaluates shouldShowNotFoundPage as true → flash
Possibly related open issues:
Expensify/App#90898 - "Hmm it's not here" page displayed when tapping report header for tasks
Expensify/App#90880 - "Hmm.. it's not here" page displayed after entering magic code
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.
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.
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:
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.
🚨 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.
After signing out and back in within the same tab, Linking.getInitialURL() still returns the previous session's URL.
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(...).
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:
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:
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.
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.
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.
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.
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
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:
Null/undefined check: Add a guard clause before accessing the failing property to handle undefined/null values gracefully
Optional chaining: Use ?. operator where applicable to safely access nested properties
Error boundary: For render-related crashes, wrap the component in an error boundary or return null/fallback UI when data is unavailable
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.
Activity
applause-bot commentedon May 22, 2026
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
MelvinBot commentedon May 22, 2026
Proposal
What is the root cause of that problem?
When onboarding completes,
completeOnboardingoptimistically setshasCompletedGuidedSetupFlow: true, which immediately unmounts theOnboardingModalNavigatorfromAuthScreens. However, the actual navigation to the target report is deferred viasetNavigationActionToMicrotaskQueue(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
ReportNotFoundGuardevaluatesshouldShowNotFoundPageastrueduring this transient window (loading flags are alreadyfalsebut 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, thedismissModal()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 callingdismissModal()followed by a deferrednavigate(), useNavigation.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
ReportNotFoundGuardcould be made aware of the onboarding-completion transition (e.g., by checking anisOnboardingTransitioningflag) 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:
completeOnboarding()fireshasCompletedGuidedSetupFlow: trueinReportUtils.ts:12005-12011OnboardingModalNavigatorunmounts fromAuthScreens.tsx:328dismissModal()fires immediately atnavigateAfterOnboarding.ts:115Promise.resolve().then(requestAnimationFrame(...))atsetNavigationActionToMicrotaskQueue.ts:6-12ReportNotFoundGuardevaluatesshouldShowNotFoundPageas true → flashPossibly related open issues:
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.Abdukhamid000 commentedon May 22, 2026
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,AccessOrNotFoundWrappermounts against that stale path, sees a policy the new account can't access, and rendersNotFoundPagefor 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):Walking the repro:
/workspace/{OLD_POLICY_ID}/rules. Sign out, sign in as new user.OpenAppruns,IS_LOADING_REPORT_DATAflips fromtrue→falsebefore the onboarding flow has had a chance to redirect.OLD_POLICY_IDin theirpoliciescollection, sopolicystays empty.isPolicyEmpty = true.isLoadingReportData === falsenow, soshouldShowFullScreenLoadingIndicatoris false.isPolicyAccessible(policy, login)returnsfalse(empty policy + login mismatch), soshouldShowNotFoundPageis true →NotFoundPagerenders.OnboardingGuardnavigates 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)), butAccessOrNotFoundWrapperdoesn'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:
isOnboardingCompleted === falseis intentionally strict —undefined(not yet hydrated) andtrueboth 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?
/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.NotFoundPagerendering 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.OnboardingGuardredirect off workspace routes beforeAccessOrNotFoundWrappermounts. 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.MobileMage commentedon May 22, 2026
🚨 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 mountsWORKSPACE_NAVIGATOR,AccessOrNotFoundWrappercomputesisPolicyAccessible(policy, login) === falsefor the new user,NotFoundPagerenders, and a frame later the post-onboarding navigate to admins chat replaces it. That gap is the flash.App/src/pages/workspace/AccessOrNotFoundWrapper.tsx
Lines 202 to 207 in 831c8cf
Two pieces collide:
On web,
react-native-webcachesLinking.getInitialURL()once at JS bundle load into a module-scoped constant:After signing out and back in within the same tab,
Linking.getInitialURL()still returns the previous session's URL.DeepLinkHandler's effect re-runs on session metadata change, so it re-runs right after sign-out. On that runhasAuthToken()returnsfalse, and it callsopenReportFromDeepLink(staleUrl, isAuthenticated=false, ...)at the line below. That captures both in closure and queues anOnyx.connectWithoutViewsubscription viawaitForUserSignIn().then(...).App/src/DeepLinkHandler.tsx
Line 78 in 831c8cf
On the next sign-in,
NVP_ONBOARDINGchanges (either via onboarding completion for a new user, or via initial hydration for an existing user wherehasCompletedGuidedSetupFlowis alreadytrue). The deferred subscription's callback runshandleDeeplinkNavigation. Theif (isAuthenticated) return;bail does not trip because the closure capturedfalse:App/src/libs/actions/Link.ts
Lines 340 to 343 in 831c8cf
Navigation.navigate(route)then fires with the stale workspace URL:App/src/libs/actions/Link.ts
Line 362 in 831c8cf
I confirmed this locally by instrumenting
handleDeeplinkNavigation. The post-sign-out subscription fires withisAuthenticatedClosure: false, focused routeHome, and the navigate to the stale workspace URL goes through. The nav-state dump at that moment shows a secondTabNavigatorpushed onto the root stack withparams.path === "/workspaces/<id>/rules"baked in, which is the signature React Navigation produces fromgetStateFromPath(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 ANDinitialUrlProcessed.currentis alreadytrue:App/src/DeepLinkHandler.tsx
Lines 60 to 83 in 831c8cf
That blocks the post-sign-out
openReportFromDeepLinkcall (the one that capturesisAuthenticated=falsein closure and queues the stale navigation for the next sign-in), without affecting the legit signed-out-first-time deep-link flow (which hasinitialUrlProcessed.current === falseon its first run and still sets up its subscription as today).I applied this guard on top of
mainlocally and confirmed the flash is gone: URL goes from/onboarding/interested-featuresstraight to/homewith no intermediate workspace path and noNotFoundPage.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 inrootState.routesthrough to onboarding completion anyway.App/src/libs/Navigation/NavigationRoot.tsx
Lines 217 to 245 in 831c8cf
Override
Linking.getInitialURLon sign-out to return the currentwindow.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, butopenReportFromDeepLinkcreates the connection inside awaitForUserSignIn().then(...)callback, so the ref has to be plumbed back out.App/src/libs/actions/Session/index.ts
Lines 1039 to 1053 in 831c8cf
Bail inside
handleDeeplinkNavigationwhenrouteis a workspace URL the current user lacks access to. Tighter, but validates the destination instead of stopping the stale queue at the source.yusufdeveloper2903 commentedon May 22, 2026
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.tsand the onboarding redirect logic insrc/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.tsor theuseOnboardingFlowRouterhook):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:
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.
melvin-bot commentedon May 22, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dmkt9 (
External)[-]Onboarding - Not here page appears briefly after completing onboarding[/-][+][$250] Onboarding - Not here page appears briefly after completing onboarding[/+]melvin-bot commentedon May 22, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022057833046172939634
lxyct825-ops commentedon May 22, 2026
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:
The root cause is that the application code at
the crash sitedoes 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:
?.operator where applicable to safely access nested propertiesThe 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.
49 remaining items
melvin-bot commentedon Jul 2, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)mallenexpensify commentedon Jul 6, 2026
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
dmkt9 commentedon Jul 7, 2026
@mallenexpensify Thanks. I've accepted the offer
mallenexpensify commentedon Jul 7, 2026
@dmkt9 paid, summary updated above. Thx.