Skip to content

[Due for payment 2026-07-21] [$250] TabNavigator NAVIGATE action not handled during deep link login flow #91777

Closed

Description

@MelvinBot

Version Number: 9.3.62-5+
Reproducible in staging?: Yes
Reproducible in production?: Unknown
Email or phone of affected tester (no customers): N/A
Issue reported by: Internal (found during investigation of #89028)
Device used: Android/iOS

Action Performed:

  1. Log in to the app
  2. Copy a conversation/chat link
  3. Log out from the app
  4. Open the conversation/chat link from step 2
  5. Log in to the app with the same account
  6. Observe the console

Expected Result:

Navigation to TabNavigator succeeds without errors; the user lands on the deep-linked report.

Actual Result:

Console error:

The action 'NAVIGATE' with payload {"name":"TabNavigator","params":{"initial":false,"screen":"ReportsSplitNavigator","params":{"pop":true,"initial":true,"screen":"Report","params":{"reportID":"..."},"path":"/r/..."},"pop":true},"pop":true} was not handled by any navigator.

Do you have a screen named 'TabNavigator'?

Root Cause Analysis

During the deep link login flow, openReportFromDeepLink awaits waitForProtectedRoutes(), which resolves when CONCIERGE appears in routeNames. However, TabNavigator is loaded lazily via getComponent, so there's a window where the RootStack has registered the screen name but the TabNavigator component hasn't fully mounted to handle the nested navigation action. The Navigation.navigate() call dispatches a NAVIGATE action targeting TabNavigator during this window, producing the unhandled action error.

Recommended Fix

Add NAVIGATORS.TAB_NAVIGATOR to the PROTECTED_SCREENS check (or add a separate readiness check that verifies TabNavigator is in the navigation state before resolving). This ensures waitForProtectedRoutes() doesn't resolve until TabNavigator is actually available to handle navigation.

Related Issues

Platforms:

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

Screenshots/Videos

Screenshot from situchan's investigation in #89028:

console
Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @situchan

Activity

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

    @MelvinBot
    ContributorAuthor

    Proposal

    What is the root cause of that problem?

    waitForProtectedRoutes() (Navigation.ts:716) resolves as soon as 'Concierge' appears in state.routeNames (Navigation.ts:702). However, routeNames reflects declared <Stack.Screen> entries, not mounted components. Since TabNavigator and Concierge are both declared as siblings in AuthScreens.tsx, they appear in routeNames simultaneously — before TabNavigator's useNavigationBuilder has run and registered its action listener. When navigate() dispatches a NAVIGATE action targeting a screen inside TabNavigator, no navigator is registered to handle it.

    Note: The issue body's suggested fix of adding TAB_NAVIGATOR to PROTECTED_SCREENS would not work — 'TabNavigator' already appears in routeNames at the same instant as 'Concierge', so it provides no additional timing signal.

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

    Modify navContainsProtectedRoutes to additionally verify that TabNavigator's nested state has stale === false, which only becomes true after useNavigationBuilder runs inside the mounted TabNavigator component:

    function navContainsProtectedRoutes(state: State | undefined): boolean {
        if (!state?.routeNames || !Array.isArray(state.routeNames)) {
            return false;
        }
        if (!state.routeNames.includes(PROTECTED_SCREENS.CONCIERGE)) {
            return false;
        }
        // Ensure TabNavigator has fully mounted and its router is registered.
        // Before mounting, tabRoute.state is either undefined or a PartialState
        // (stale !== false), and navigation actions targeting nested screens will fail.
        const tabRoute = state.routes?.find((r) => r.name === NAVIGATORS.TAB_NAVIGATOR);
        return tabRoute?.state?.stale === false;
    }

    Both NAVIGATORS and PROTECTED_SCREENS are already imported in this file. The stale === false pattern is already used in the codebase (e.g., TabNavigator.native.tsx:63, usePreserveNavigatorState.ts:13).

    What alternative solutions did you explore?

    Adding TAB_NAVIGATOR to PROTECTED_SCREENS (as the issue suggests) — rejected because routeNames reflects declared screens, not mounted ones, so both 'Concierge' and 'TabNavigator' appear simultaneously.

    Why stale === false is the right signal

    When NavigationContainer initializes with a deep link initialState, the full navigation tree is pre-hydrated — including TabNavigator's nested state. This pre-hydrated state is a PartialState where stale is not false. When TabNavigator actually mounts, useNavigationBuilder calls getRehydratedState, which sets stale: false and registers the navigator's action listener. Only then can dispatched actions be handled. The state change propagates up to the root, firing the onStateChange listener that waitForProtectedRoutes subscribes to.

    Possibly related issues


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

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 27, 2026
  4. KJ21-ENG commented on May 27, 2026

    @KJ21-ENG
    Contributor

    Proposal

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

    When a signed-out user opens a report deep link and then logs in, the app sometimes dispatches the deferred report navigation too early. The navigation action targets TabNavigator, but the native app logs an unhandled NAVIGATE action instead of landing cleanly on the report.

    What is the root cause of that problem?

    openReportFromDeepLink() waits for Navigation.waitForProtectedRoutes() before replaying the deep link after sign-in. That helper currently resolves as soon as the navigation state's routeNames includes PROTECTED_SCREENS.CONCIERGE, based on the assumption that one protected screen name means the protected tree is ready.

    That is not strong enough for this flow. In AuthScreens, TabNavigator is registered as the first protected root stack screen but is loaded lazily with getComponent={loadTabNavigator}. There is therefore a window where protected route names are present, but the TabNavigator route/nested state has not mounted far enough to handle the nested report navigation generated from the deep link. The deferred Navigation.navigate(route) then dispatches an action whose payload starts at TabNavigator, and React Navigation reports that no navigator handled it.

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

    Tighten the readiness contract in src/libs/Navigation/Navigation.ts. Instead of resolving waitForProtectedRoutes() from the presence of CONCIERGE in routeNames alone, make the helper verify that the authenticated navigation tree includes an initialized NAVIGATORS.TAB_NAVIGATOR route before resolving. Concretely, update navContainsProtectedRoutes() to require both the protected route registration and a mounted TabNavigator route in state.routes, preferably with nested state/key present so it can receive targeted child navigation. Keep the listener behavior the same so the promise resolves on the next navigation state event once the tab navigator finishes mounting.

    This keeps the fix at the boundary that already promises "protected routes are ready" instead of adding another delay in openReportFromDeepLink(). Add a focused unit test for the readiness helper if it is exported for testability, or cover the behavior through waitForProtectedRoutes() by simulating state events: it should not resolve when only CONCIERGE is in routeNames, and it should resolve once TabNavigator exists as an initialized route.

    • Files touched (with call sites): src/libs/Navigation/Navigation.ts — navContainsProtectedRoutes() / waitForProtectedRoutes() readiness check.
    • Platforms: Android and iOS native app through shared navigation code.
    • Code paths / callers explicitly NOT touched: link parsing, public room access, onboarding gating, report fallback selection, and the general Navigation.navigate() dispatch machinery.
    • API contracts or backend behavior changes: no.

    What alternative solutions did you explore? (Optional)

    An alternative is to add a second wait only in openReportFromDeepLink() before calling Navigation.navigate(route), but that would duplicate a readiness concern in one caller and leave waitForProtectedRoutes() with a misleading contract. Another option is to make TabNavigator eager instead of lazy, but that increases startup cost for a race that can be solved by waiting for the existing lazy navigator to be mounted.

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 27, 2026
  6. melvin-bot commented on May 27, 2026

    @melvin-bot

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

  7. melvin-bot commented on May 27, 2026

    @melvin-bot
  8. changed the title [-]TabNavigator NAVIGATE action not handled during deep link login flow[/-] [+][$250] TabNavigator NAVIGATE action not handled during deep link login flow[/+] on May 27, 2026
  9. lxyct825-ops commented on May 27, 2026

    @lxyct825-ops

    Proposal

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

    [$250] TabNavigator NAVIGATE action not handled during deep link login flow

    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 action 'NAVIGATE' with payload {"name":"TabNavigator","params":{"initial":false,"screen":"ReportsSplitNavigator","params":{"pop":true,"initial":true,"screen":"Report","params":{"reportID":"..."},"path":"/r/..."},"pop":true},"pop":true} was not handled by any navigator.
        Do you have a screen named 'TabNavigator'?
    

    The root cause is that the application code at Do you have a screen named 'TabNavigator'? 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.

  10. lxyct825-ops commented on May 27, 2026

    @lxyct825-ops

    Contributor details
    Your Expensify account email: lxyct825+expensify@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01174eaf71ab8fc150

  11. melvin-bot commented on May 27, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  12. aswin-s commented on May 27, 2026

    @aswin-s
    Contributor

    Proposal

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

    On iOS and Android, when a user opens a deep link to a chat/report while logged out and then logs in with the same account, the console logs The action 'NAVIGATE' ... was not handled by any navigator. Do you have a screen named 'TabNavigator'? and navigation to the deep-linked report can fail. Expected: navigation to TabNavigator succeeds and the user lands on the deep-linked report without errors.

    What is the root cause of that problem?

    The deep-link navigate is gated behind Navigation.waitForProtectedRoutes() (src/libs/actions/Link.ts:306), which resolves via navContainsProtectedRoutes() (src/libs/Navigation/Navigation.ts:696-703). That predicate only checks state.routeNames.includes(PROTECTED_SCREENS.CONCIERGE) (line 702). In react-navigation, routeNames is the static list of declared screen names that is populated synchronously the moment the RootStack.Navigator renders (all screens in AuthScreens.tsx, including CONCIERGE and TAB_NAVIGATOR, are declared together). It is not a signal that any screen has actually mounted. TAB_NAVIGATOR is declared with a lazy getComponent={loadTabNavigator} and lives in persistentScreens (AuthScreens.tsx:184-190). So waitForProtectedRoutes() resolves as soon as the RootStack declares its screen names, then Navigation.navigate() (Link.ts:362) dispatches a NAVIGATE targeting the nested TabNavigator → ReportsSplitNavigator → Report chain before TabNavigator has mounted and registered its child navigator to handle the action — producing the unhandled-action error.

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

    1. src/libs/Navigation/Navigation.ts:696-703 — change the readiness signal in navContainsProtectedRoutes from inspecting state.routeNames (declared names) to inspecting state.routes (actually-mounted navigators), e.g. confirm a route whose name is NAVIGATORS.TAB_NAVIGATOR exists in state.routes before resolving, since TabNavigator is the navigator that must handle the dispatched deep-link NAVIGATE.
    2. Keep waitForProtectedRoutes (Navigation.ts:716-734) intact; its addListener('state', ...) path will then continue waiting until the listener observes a state where TabNavigator is present in routes, rather than resolving immediately on the first emitted state.
    3. Import NAVIGATORS in Navigation.ts if not already present, to reference NAVIGATORS.TAB_NAVIGATOR in the new check.
    4. No platform-twin files needed — Navigation.ts, AuthScreens.tsx, and SCREENS.ts are shared across iOS/Android/web; the fix applies to all platforms reproducing the error.

    What alternative solutions did you explore? (Optional)

    Adding NAVIGATORS.TAB_NAVIGATOR to PROTECTED_SCREENS (the issue's suggested fix) does not work: it would still be matched against routeNames, which already contains TabNavigator at the same instant as Concierge, so the resolve timing is unchanged.

  13. wildan-m commented on May 27, 2026

    @wildan-m
    Contributor

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  14. 57 remaining items

  15. melvin-bot commented on Jul 14, 2026

    @melvin-bot

    @situchan / @daledah @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  16. melvin-bot commented on Jul 17, 2026

    @melvin-bot

    @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

  17. melvin-bot commented on Jul 21, 2026

    @melvin-bot

    @situchan 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  18. situchan commented on Jul 21, 2026

    @situchan
    Contributor

    BugZero Checklist:

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

      Link to comment: N/A

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

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

    Regression Test Proposal

    No need. Just console error not affecting production users

  19. mallenexpensify commented on Jul 23, 2026

    @mallenexpensify
    Contributor

    @daledah from the C+ doc

    If there are posts on the PR or issue that reference a regression or deploy blocker, C+ posts on the issue and confirms regression (which will reduce pay by 50%) or provides reasoning why they shouldn’t be considered. If the C+ doesn’t update the issue, the contributor manager making the payment will assume any mention of a regression or deploy blockers reduces the issue amount.

    @MelvinBot payment-review
    MODE: <closed-no-pr | payment-due>
    JOB_PRICE: 250 # override if the title bounty differs

    Run the C+ payment framework for this issue and post a structured, evidence-cited
    recommendation. Rules:

    • Suggest only — never auto-pay. A human confirms.
    • Every point / adjustment MUST cite a specific comment permalink. No permalink → no point.
    • Round every %→$ result up to the nearest $25: amount = ceil((pct × JOB_PRICE) / 25) × 25.

    If MODE = closed-no-pr:

    1. Run the eligibility gate; if it fails, or the token-saving skip-gate trips
      (<~8 non-bot comments AND no C+ engagement markers, or closed <48h, or spam/invalid),
      return "$0 — skipped" with a one-line reason and STOP.
    2. Bucket the close reason (A/B/C), score the 5 factors 0–10 with permalinks.
    3. Payout = 25% of JOB_PRICE if score ≥ 8, else $0.

    If MODE = payment-due:

    1. Start at 100% of JOB_PRICE.
    2. Decreases: for any regression, read the offending PR + issue and decide if it's
      truly attributable to this author/reviewer. If yes, −50% per verified regression.
      If fault is unclear, DO NOT deduct — flag for human review.
    3. Increases: evaluate the C+ increase framework (multiple PRs, additional fixes,
      scope expansion, core-flow changes, deploy blockers audited, performance,
      test coverage, files touched), each backed by a permalink.

    Output: recommended $ amount, per-line reasoning with permalinks, confidence
    (High/Med/Low), and any manual-review flags.

  20. MelvinBot commented on Jul 23, 2026

    @MelvinBot
    ContributorAuthor

    🤖 C+ payment recommendation — payment-due, JOB_PRICE = $250. Suggestion only; a human confirms before paying.

    Recommendation

    Reviewer Start Adjustment Recommended
    daledah $250 −50% (1 verified regression) $125
    situchan $250 none clearly attributable $250 — but flag for human review

    Reasoning (every point cited)

    One verified regression exists, and it reduces pay by 50%. The first fix, PR #91796, was merged then reverted because it broke 5 critical flows that share waitForProtectedRoutes() (it hung on cold start). This was confirmed by the C+ themselves — daledah wrote "our PR #91796 was reverted because it has some regressions" and again that "the original PR was reverted". The revert spawned deploy blockers #92023, plus #92039/#92030/#92041/#92047 and a cold-start notification regression, all traced in the revert analysis. Per the C+ doc rule you quoted: a confirmed regression → −50%. All blockers trace to a single reverted PR / one root cause, so this is one regression event, not stacked. mallenexpensify also flagged "at least one regression".

    Attributed to daledah. daledah is the issue assignee who directed and reviewed PR #91796 (author MelvinBot, assignee daledah; reviewers were daledah/MelvinBot/yuwenmemon). The reverted fix is the one they own → −50% → $125 (ceil((0.5 × 250)/25) × 25 = 125).

    situchan — flag for human review, do not auto-deduct. situchan is not listed among the reviewers of the reverted PR #91796; they entered on the successful remediation, PR #92482 (deployed to production in 9.4.33-8, fixed all blockers). The framework says: when fault for a regression is unclear, do not deduct — flag it. So I'm not applying the −50% to situchan. If you consider the issue's regression jointly owned by both C+, apply the same −50% → $125; otherwise $250. This is a judgment call for you as CM.

    No increases warranted. The second PR was remediation for the revert, not scope expansion or a bonus-worthy additional fix, so no increase factors apply.

    Manual-review flags

    Confidence: High that a verified regression exists and is attributable to daledah. Medium on situchan's share (depends on your read of joint ownership).

  21. melvin-bot commented on Jul 27, 2026

    @melvin-bot

    @situchan Huh... This is 4 days overdue. Who can take care of this?

  22. mallenexpensify commented on Jul 28, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @daledah due $125 via NewDot
    Contributor+: @situchan due $250 via NewDot

  23. quinthar commented on Aug 19, 2026

    @quinthar
    Contributor

    Approved $125 to @daledah

  24. laurenreidexpensify commented on Aug 24, 2026

    @laurenreidexpensify
    Contributor

    $250 approved @situchan New Expensify

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions