-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(router-core): lane match loader rewrite #7805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sheraff
wants to merge
61
commits into
main
Choose a base branch
from
fix-router-core-lane-match-loader
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
ceaa4d2
fix: lane match loader rewrite
Sheraff adf73dd
fix client/server build
Sheraff 6f75f50
adopt preloaded beforeLoad
Sheraff f4b8934
fix adoption of server data
Sheraff 7b5436b
fix internal error propagation, only user code is try/catch
Sheraff fb21a42
fix: solid Transitionner unsub cleanup before early return
Sheraff bf90602
fix: react-router not found ambiguous assertion
Sheraff f2ccae2
docs
Sheraff da5cb82
fix: preload always releases its borrowed lease
Sheraff cc21be0
error priority handling
Sheraff 3a56878
Merge branch 'main' into fix-router-core-lane-match-loader
Sheraff 2e8bbbe
Merge remote-tracking branch 'origin/main' into fix-router-core-lane-…
Sheraff af0f0c7
tests
Sheraff f54bf4b
fix #7673
Sheraff 7be1149
ci: apply automated fixes
autofix-ci[bot] 0ed58ea
rename consts to uppercase
Sheraff 4fd731e
cleanup load-client
Sheraff acbfba3
fix load-client for undefined loaderData
Sheraff 8fcf2eb
cleanup load-server
Sheraff 3ba393e
ci: apply automated fixes
autofix-ci[bot] 3d252e6
more cleanup
Sheraff 4150cdf
ci: apply automated fixes
autofix-ci[bot] 3ecc24b
update tests
Sheraff c801dcc
final coverage
Sheraff ded47d1
final fixed issue tests
Sheraff 16dfcf9
ci: apply automated fixes
autofix-ci[bot] 05efe8c
Merge remote-tracking branch 'origin/main' into fix-router-core-lane-…
Sheraff ba80053
minor byte shave in router-core
Sheraff 125b13f
minor byte shave in Match
Sheraff 2bba8fa
minor byte shaving
Sheraff 1f50bd3
ci: apply automated fixes
autofix-ci[bot] cf40d59
comments and cleanup
Sheraff ec631eb
ci: apply automated fixes
autofix-ci[bot] b56cb51
test: does `declare` save any bytes?
Sheraff ef40259
test again, but i selected everything this time
Sheraff e177851
test: same, but property wasn't even initialized
Sheraff e7322f8
simplify Transitioner based on having a unique transitioner per router
Sheraff 9810491
ci: apply automated fixes
autofix-ci[bot] 45f7731
deprecated test
Sheraff a8d7c8c
no reset key on server
Sheraff f90018f
ci: apply automated fixes
autofix-ci[bot] f7f266b
some jsdoc
Sheraff 5a8cc80
simplify getSemanticMatch
Sheraff 1b20933
more jsdoc
Sheraff 83fea0f
ci: apply automated fixes
autofix-ci[bot] 1f4838d
beforeLoad context cleanup on error + naming + misc bugs
Sheraff 4746633
server preload is no-op
Sheraff 6683863
console.error over promise.reject for lifecycle errors
Sheraff 3d68db6
INTERNALS update
Sheraff 423f905
fix(router-core): complete lane match loader rewrite (#7858)
Sheraff 7443d96
Merge remote-tracking branch 'origin/main' into fix-router-core-lane-…
Sheraff 1f27102
fix(router-core): harden lane loading lifecycle (#7869)
Sheraff 03a1fde
perf(router): reduce SSR lane loading overhead (#7875)
Sheraff 9043f4f
Merge branch 'main' into fix-router-core-lane-match-loader
Sheraff da82a47
ci: apply automated fixes
autofix-ci[bot] f84d087
ci: apply automated fixes (attempt 2/3)
autofix-ci[bot] 90a7f39
fix(router): address lane loader regressions (#7880)
Sheraff baa18cd
fix(router): final-review regressions, changeset, and byte recovery (…
Sheraff 55ceb3a
chore(router-core): lane match loader final byte-shave (#7885)
Sheraff fd8e256
Merge branch 'main' into fix-router-core-lane-match-loader
Sheraff a4d5b8f
Merge remote-tracking branch 'origin/main' into fix-router-core-lane-…
Sheraff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| '@tanstack/router-core': patch | ||
| '@tanstack/react-router': patch | ||
| '@tanstack/solid-router': patch | ||
| '@tanstack/vue-router': patch | ||
| --- | ||
|
|
||
| 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 `gcTime` and `preloadGcTime` are reduced from 30 minutes (`1_800_000`) to 5 minutes (`300_000`). | ||
|
|
||
| **Removed / changed public API** | ||
|
|
||
| - `RouterState` no longer includes `loadedAt`, `isTransitioning`, `statusCode`, or `redirect`. Use `match.updatedAt` in place of `loadedAt`; subscribe to `router.state.status` / `router.state.isLoading` in place of `isTransitioning`; server response status and redirect handling are now internal to the server loader and are no longer exposed on `router.state`. | ||
| - `RouteMatch.fetchCount` has been removed, with no replacement — it was purely informational. | ||
| - `RouteMatch.status` no longer includes `'redirected'` (it remains `'pending' | 'success' | 'error' | 'notFound'`) — redirected matches are dropped from the match list instead of being rendered. | ||
| - `RouteMatch.globalNotFound` has been renamed and privatized to the internal `_notFound` field. Use `match.status === 'notFound'` instead. | ||
| - Removed `RouterCore` members `getMatch()`, `updateMatch()`, `cancelMatch()`, and `cancelMatches()` — read matches from `router.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()` — use `router.state.matches.some((m) => m.status === 'notFound')`. | ||
| - Removed `looseRoutesById` — use `routesById`. | ||
| - Removed `isPrerendering()`, `isViewTransitionTypesSupported`, and `viewTransitionPromise`, with no replacement. | ||
| - Removed `getParsedLocationHref()` and `clearExpiredCache()`, with no replacement — expired cache entries are now reconciled automatically as part of match commit. | ||
| - Removed `latestLoadPromise` and `beforeLoad()`, with no replacement. | ||
| - `commitLocationPromise` and `pendingBuiltLocation` are now private (`_commitPromise`, `_pendingLocation`) and no longer part of the public `RouterCore` surface. | ||
| - Removed the exported `GetMatchFn` and `UpdateMatchFn` types, along with the methods they typed. | ||
| - Removed the standalone `getMatchedRoutes()` export from `@tanstack/router-core` — use the `router.getMatchedRoutes()` instance method instead. | ||
| - `MatchRoutesOpts.preload` and `MatchRoutesOpts.dest` have been removed. | ||
| - `StartTransitionFn` is now `(fn, expected, urgent?) => Promise<boolean>` (previously `(fn) => void`). This only affects custom framework adapters that implement `startTransition`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: TanStack/router
Length of output: 18706
🏁 Script executed:
Repository: TanStack/router
Length of output: 3407
🏁 Script executed:
Repository: TanStack/router
Length of output: 16531
Use a major changeset for the API removals. The affected sections remove public members and change
StartTransitionFn’s signature, so patch release metadata is inconsistent with the documented breaking surface.🤖 Prompt for AI Agents