Skip to content

test(platform): the router-core _nonReactive patch is proven only for split routes; the awaited-loader path, which needs no split, has no test #4911

Closed

Description

@yannickmonney

Problem

preloadRoute logs TypeError: Cannot read properties of undefined (reading '_nonReactive') when router-core 1.168.9's loadRouteMatch reads a match that a navigation dropped while the preload waited. patches/@tanstack%[email protected] (fbd4013, first released in v0.5.74) guards both such reads, so main no longer logs it. Its proof covers one of the two ways in:

  • Pinned: a split route without a loader. Preloading it waits on its chunk, a navigation commits meanwhile, and clearExpiredCache drops the cached match (services/platform/app/lib/router-split-preload.test.ts).
  • Not pinned: an awaited loader. Preload a route whose loader the router awaits, open it, and leave before the loader answers. Opening makes the preload's match the navigation's pending one, the navigation that leaves drops it, and the preload reads it when the loader returns (load-matches.js:489). The project page awaits its project in its loader (/dashboard/$id/projects/$projectId, for the title), and the projects list preloads it on row hover.
  • This path needs no split. Releases up to v0.5.73 had no route chunks (tanstackRouter() without autoCodeSplitting; checked at v0.5.50, v0.5.60, v0.5.66, v0.5.70 and v0.5.73) but had the awaited project loader and the row-hover preload (checked at v0.5.60 and v0.5.65). A report of this error was filed before the split landed.
  • patches/README.md says to remove the patch when the router moves to "a release whose loader passes the test unpatched". As written, an upgrade could drop the patch once the split case passes, with the loader case unproven.
  • .agents/repo.md still names only the postgres.js patch under "A patched dependency stays pinned, proven and dated".

Upstream tracks the bug as TanStack/router#7759 (a loader or a lazy chunk in flight when the match is evicted), closed by the loader rewrite in TanStack/router#7805; router-core 1.171.16 is the first release with it. The platform pins 1.168.9.

Expected

  • router-split-preload.test.ts gets a second case: preload a route with a pending loader, open it, leave, then answer. Nothing is logged, and the route opens again afterwards.
  • patches/README.md covers the loader path under Why, Proof and Remove it when (both cases pass unpatched; 1.171.16 or later is the candidate), and links the upstream issue.
  • .agents/repo.md names the router-core patch.

Regression: the new case logs the TypeError with unpatched router-core 1.168.9 and passes on main's patched install.

Severity and owner

  • Severity: low. Users see no change: main already guards both reads. The gap is in the proof that decides when the patch can go.
  • Owner: platform (router integration, dependency patches).
  • Found by: TALE-394, 2026-10-13, investigating this error. Reproduced locally at 715dc15ad with synthetic jsdom routes shaped like the platform's, no network: with unpatched router-core 1.168.9, opening a preloaded route whose loader is still pending and leaving before it answers logs the error from load-matches.js:489; with the repo's patch, nothing is logged. Leaving without opening logs nothing in either.

Activity

  1. added
    agent-ready
    on Oct 29, 2026
  2. added a commit that references this issue on Oct 30, 2026
    f129087
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyimprovement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions