Patch Changes
-
#7883
baa18cd- Rewrite match loading around a lane-based scheduler that tracks each navigation, preload, and background reload as an ordered unit of work. This fixes pending/redirect/retry state leaking between overlapping navigations, restores correct SSR status codes for redirects, errors, and not-found responses, and closes hydration gaps where the client re-ran work the server had already completed.- Route
headers()now only runs on the server, matching the documented behavior — it is no longer invoked during client-side asset projection. - Default
gcTimeandpreloadGcTimeare reduced from 30 minutes (1_800_000) to 5 minutes (300_000).
Removed / changed public API
RouterStateno longer includesloadedAt,isTransitioning,statusCode, orredirect. Usematch.updatedAtin place ofloadedAt; subscribe torouter.state.status/router.state.isLoadingin place ofisTransitioning; server response status and redirect handling are now internal to the server loader and are no longer exposed onrouter.state.RouteMatch.fetchCounthas been removed, with no replacement — it was purely informational.RouteMatch.statusno longer includes'redirected'(it remains'pending' | 'success' | 'error' | 'notFound') — redirected matches are dropped from the match list instead of being rendered.RouteMatch.globalNotFoundhas been renamed and privatized to the internal_notFoundfield. Usematch.status === 'notFound'instead.- Removed
RouterCoremembersgetMatch(),updateMatch(),cancelMatch(), andcancelMatches()— read matches fromrouter.state.matches(e.g.router.state.matches.find((m) => m.id === id)); there is no replacement for mutating or cancelling an individual in-flight match from outside the router. - Removed
hasNotFoundMatch()— userouter.state.matches.some((m) => m.status === 'notFound'). - Removed
looseRoutesById— useroutesById. - Removed
isPrerendering(),isViewTransitionTypesSupported, andviewTransitionPromise, with no replacement. - Removed
getParsedLocationHref()andclearExpiredCache(), with no replacement — expired cache entries are now reconciled automatically as part of match commit. - Removed
latestLoadPromiseandbeforeLoad(), with no replacement. commitLocationPromiseandpendingBuiltLocationare now private (_commitPromise,_pendingLocation) and no longer part of the publicRouterCoresurface.- Removed the exported
GetMatchFnandUpdateMatchFntypes, along with the methods they typed. - Removed the standalone
getMatchedRoutes()export from@tanstack/router-core— use therouter.getMatchedRoutes()instance method instead. MatchRoutesOpts.preloadandMatchRoutesOpts.desthave been removed.StartTransitionFnis now(fn, expected, urgent?) => Promise<boolean>(previously(fn) => void). This only affects custom framework adapters that implementstartTransition.
- Route
-
Updated dependencies [
baa18cd]:- @tanstack/router-core@1.171.16-pre.0