Repository navigation
Closed
Labels
Description
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
clearExpiredCachedrops 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()withoutautoCodeSplitting; 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.mdsays 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.mdstill 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.tsgets 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.mdcovers 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.mdnames 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:
mainalready 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
715dc15adwith 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 fromload-matches.js:489; with the repo's patch, nothing is logged. Leaving without opening logs nothing in either.
Activity
test(platform): pin the router-core patch on the awaited-loader path