0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
Commit graph

6,654 commits

Author SHA1 Message Date
Ciarán Curley
df8bbf217f
docs: use new query methods (#7100)
docs: use queryClient.query() in guides and agent skills

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 17:59:20 +02:00
Flo
793514d5e4
test(benchmarks): disable Maglev in CodSpeed memory runs (#8625)
CodSpeed's --no-opt only disables TurboFan on Node 24, so Maglev still
compiles. Under --predictable those compiles run synchronously inside the
triggering request, and the forced GC before the measured call can discard
optimized code so recompiles land in the measured window. Maglev's malloc'd
Zone scratch (32 KiB segments) then dominates allocation metrics and varies
with per-process feedback state.

The bimodal +32,792 B / +1 alloc in `mem server error-paths unmatched
(react)` is one Maglev Zone segment allocated while compiling React Fizz's
per-request stream `write` closure; ~97% of that bench's allocation was
compiler scratch. Retained-object measurements are unaffected (Zone memory
is freed after each compile).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 17:33:04 +02:00
Flo
9595b9745d
ci: let workflow_dispatch publish bundle-size history on main (#8620)
The workflow already declares a workflow_dispatch trigger, but no job
accepted that event, so manual runs on main were always skipped. When a
push run is lost (e.g. cancelled waiting for a runner), main's tip gets
no history entry and PR comments silently fall back to an older baseline.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 10:53:58 +02:00
Flo
e7ab1570ec
perf(solid-router): let mergeProps memoize the Link's own props (#8619)
* perf(solid-router): let mergeProps memoize the Link's own props

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(solid-router): pin how Link element props, state props and handlers reach the anchor

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* ci: retrigger benchmarks against refreshed main baselines

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 10:36:08 +02:00
Flo
efc2042c2d
perf(router): skip Link work for routes a navigation leaves (#8602)
* test(benchmarks): add departing and retained Link navigation cases

Add lane-* cases to the React Link performance harness, with per-navigation
sync, onLoad and total timings in the paired runner.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* perf(react-router): share one location subscription per route's Links

Links subscribe to a scope owned by their match context instead of each
subscribing to the location store. A scope skips a location publication
whose navigation leaves its route, so Links that are about to unmount do
no work. Clicks and preloads resolve from the location a Link displays,
and mask builds use the same source location as their destination.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(benchmarks): add Solid departing and retained Link navigation harness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): hold the location of Links in a departing match

Each Match owns one memo that keeps its Links' source location when the
publishing navigation leaves the route, so those Links do no work.
Clicks and preloads resolve from that source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(react-router): trim the Link scope's bundle cost

Key each router's link scopes by route id instead of carrying them in a
`[routeId, linkScope]` match context tuple. `matchContext` provides the
route id again, so `Match`, `Outlet`, `useMatch` and `useParentMatches` /
`useChildMatches` match main, and the outside-every-match holder becomes
the `undefined` key of the same registry. A scope without links still
releases its location, so keeping one per route id holds none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): add Vue departing and retained Link navigation harness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): hold the location of Links in a departing match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): add a real-browser Link INP harness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): gate departing Links in their own location memo

Drop the per-Match memo and the third match-context slot. Each Link reads
its route id once at setup and, while the publishing navigation leaves
that route, keeps its previous location in the memo it already owns.
Links mounting in an already-departing route read the pending location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): add Vue to the real-browser Link INP harness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(solid-router): build Link navigations from the live location state

The Link location memo deduplicated by href, so a same-href navigation that only changed history state left clicks and preloads building from the previous location's state.
Compare by identity instead; downstream href and active memos still compare by value, so unchanged Links do not touch the DOM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(react-router): drop the Link scope's reentrant publication re-check

A listener that publishes a new location while a route's Links derive is not a
supported use case, so the scope no longer re-reads the store after notifying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(react-router, router-core): follow-up Link improvements (#8607)

* perf(router-core): cache location-independent masked destinations

A mask that reads the current location already marks the result as
source-dependent through the shared usedCurrent flag, and route masks
belong to the route tree and options whose updates replace the cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(react-router): hydrate hash-sensitive Links through the scope's server snapshot

The Link's location subscription already has a server-snapshot slot.
Reporting an active hash-sensitive Link as inactive there replaces the
per-Link useHydrated subscription with identical hydration output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(react-router): follow href and reloadDocument changes of a mounted Link

The destination memo did not depend on href, so a Link whose href alone
changed kept displaying, preloading and navigating to the old target.
Clicks also navigated with the memo's copy of the options, so a changed
reloadDocument only applied once another destination prop changed.
Navigate with the current options and the displayed source location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(react-router): hold a Link's intent preload timer on its own ref

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(history): avoid copying navigation arguments when checking blockers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): opt-in intent preloading for the Link lane cases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: changeset

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router, vue-router): follow-up Link improvements (#8609)

* test(benchmarks): measure Solid and Vue Link lanes with intent preloading

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): reuse a Link-owned destination so fixed Links hit the location cache

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): pass navigation controls through the Link-owned options

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(solid-router): cover Link clicks after a state-only navigation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): read Link options directly with a single splitProps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): keep the Link preload timer in a closure

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): let the Link observer read the preload mode directly

The internal useIntersectionObserver no longer returns an unused accessor and
takes the preload mode instead of two predicates (its unit test is updated).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): create the Link hydration signal only for SSR routers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): let element insertion track Link children without a memo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(solid-router): call a Link's ref once per element

The ref no longer comes from the props memo, so href/active changes do not
re-run the element's ref effect. Drops the mergeRefs import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): derive a Link's href and active state in one computation

The destination build, href, external/blocked classification and active state
share one memo whose unchanged result keeps its identity, so a navigation that
leaves a Link as it was notifies nothing downstream. Presentation props only
rerun the props memo. The server derives the same values once, without memos.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): use the t quantile for the lane comparison's round count

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(solid-router): split a Link's props once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): reuse a Link-owned destination so fixed Links hit the location cache

Navigation controls travel on the same object, so clicks no longer re-list them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): pick a Link's element props with one shared key set

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): derive a Link's href and active state in one computed

The preload effects read a location-independent mode, so a navigation no
longer queues them for every Link. A Link whose destination updater navigates
while it derives derives again for the newer location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): keep the Link preload timer in a closure

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): drop the unused IntersectionObserver ref per Link

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): return plain empty Link props without a router

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): render server Links without reactive wrappers

The server returns shallow refs and reads Link props directly, without the
attrs snapshot, its update hook, the props computed or a template ref.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(vue-router): drop the deferred re-derivation for updaters that navigate

A search updater that navigates while a Link derives is not a supported use
case; remove the retry that existed only for it, and its test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: add changeset for the Solid and Vue Link follow-up

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* chore(benchmarks): remove the real-browser Link INP harness

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(solid-router, vue-router): rebuild masks whose options are stores

Router core now reuses masked locations built from the same options object
when the mask does not read the current location. Solid and Vue Links keep
one destination object while their navigation options keep their identity,
and only a store/reactive option value forced a fresh object per location.
A plain mask object holding a store (e.g. `mask={{ to, params: store }}`)
therefore kept the mask built from the store's first value. The mask's own
values are destination options too, so check them for stores as well.

React has no in-place reactive values: a changed mask prop changes identity
and rebuilds. Add the equivalent React coverage for prop and inherited masks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(benchmarks): remove the ad-hoc Link lane harnesses

The link-churn scenario covers this work in CodSpeed. Removes the Solid and
Vue lane harnesses and restores link-performance to its main content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style: name tuple indexes in Link code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(react-router): stop treating _fromLocation as a Link prop

`_fromLocation` is an internal router option, not a Link prop: the Link
always builds from its own scope's location. It stays among the stripped
router option keys so code that still passes it does not leak an attribute
to the element.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(solid-router): stop treating _fromLocation as a Link prop

`_fromLocation` is an internal router option, not a Link prop: the Link
always builds from the location its match presents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(vue-router): stop treating _fromLocation as a Link prop

`_fromLocation` is an internal router option, not a Link prop: the Link
always builds from the location its match presents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(react-router): drop _fromLocation from the Link's option keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-05 21:27:33 +02:00
Flo
c4cb0e4cae
test(router): Link tests that hold on main, ahead of the departing-Link work (#8611)
Tests written for #8602 that already pass on main: rewrites of Link tests
that asserted on a detached anchor after its route unmounted, and Link
destination tests for Solid, Vue and React (in-place store/reactive inputs,
inherited params, masks, frozen options, state-only navigations).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 22:46:37 +02:00
Flo
2741b159af
test(benchmarks): add a client-nav scenario for departing, staying and mounting Links (#8604)
* test(benchmarks): add a client-nav scenario for departing, staying and mounting Links

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): size link-churn to 60 staying and 200 departing Links

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(benchmarks): halve link-churn to 30 staying and 100 departing Links

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 19:25:58 +02:00
Flo
dfe3dea88a
perf(router-core, history): small parsing and bundle-size cleanups (#8605)
* fix(history): keep a leading query or fragment out of parseHref's pathname

parseHref compared the '?' and '#' indexes with '> 0', so an href that
starts with a query or fragment (reachable via hash history '/#?x=1'
or memory entries) kept it in the pathname as well, and the router
location became '?x=1?x=1'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(history): read hash-history locations with indexOf/slice

Replace split('#').slice(1)/join('#') with one indexOf and two slices
when reading the hash-history location. Characterization tests from
#8351 cover nested fragments, encoded '#', and an empty hash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(router-core,history): use slice where substring bounds are ordered

Every converted call has non-negative, ordered bounds (fixed offsets,
indexOf results within the same segment, or guarded by a '<' check).
extractParams' affix-stripping calls and the wildcard-tail suffix in
parseSegments keep substring: their bounds can cross.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(router-core,history): drop a duplicated flag and a createHref wrapper

buildLocation's currentMatch now reads the location through current(),
which already marks the build as location-dependent. Browser history
passes its createHref directly; createHistory already wraps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:52:45 +02:00
Flo
b839f47027
test(e2e): wait for the destination route before asserting shared widget CSS (#8603)
/lazy-css-lazy and /lazy-css-static both render `shared-widget`, and the URL
updates before the departing route unmounts, so assertions after `waitForURL`
could hit the old widget while it was being detached and read `""`. Wait for a
destination-only marker and use retrying `toHaveCSS` assertions instead.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:02:43 +02:00
Flo
2413cc0098
perf(react-router): reduce component nesting per route match (#8594)
* perf(react-router): reduce component nesting per route match

* make it stable between server and client
2026-10-03 22:33:29 +02:00
Sarah Gerrard
1f0f20a320
chore(react-start-rsc): upgrade Rspack to 2.2.7 (#8542)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-01 20:50:06 +02:00
Flo
d35aab425b
fix(router): cancel pending link preload before navigation (#8579) 2026-10-01 13:52:43 +02:00
github-actions[bot]
57e126e99d
ci: Version Packages (#8531) release-2026-09-30-1747 @tanstack/react-router@1.170.41 @tanstack/react-start-client@1.168.39 @tanstack/react-start-rsc@0.1.59 @tanstack/react-start-server@1.167.46 @tanstack/react-start@1.168.60 @tanstack/router-cli@1.167.40 @tanstack/router-core@1.171.34 @tanstack/router-generator@1.167.40 @tanstack/router-plugin@1.168.42 @tanstack/router-vite-plugin@1.167.42 @tanstack/solid-router@1.170.38 @tanstack/solid-start-client@1.168.37 @tanstack/solid-start-server@1.167.44 @tanstack/solid-start@1.168.57 @tanstack/start-client-core@1.170.34 @tanstack/start-plugin-core@1.171.49 @tanstack/start-server-core@1.169.39 @tanstack/start-static-server-functions@1.167.39 @tanstack/start-storage-context@1.167.36 @tanstack/vue-router@1.170.37 @tanstack/vue-start-client@1.167.40 @tanstack/vue-start-server@1.167.44 @tanstack/vue-start@1.168.56
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-30 11:41:29 -06:00
Tanner Linsley
d521abd71c
fix(start): align server function transport behavior (#8573) 2026-09-30 11:29:54 -06:00
Flo
614bc27034
chore(deps): update TanStack Store to 0.11.2 (#8568)
* chore(deps): update TanStack Store to 0.11.2

* chore(deps): regenerate Store 0.11.2 lockfile
2026-09-30 12:42:07 +02:00
bkuzmanoski
41ebd28867
fix(start-plugin-core): use http scheme for sitemap xmlns (#8127)
fix: use http scheme for sitemap xmlns per sitemaps.org spec
2026-09-28 00:48:33 +02:00
Flo
05223c2ada
perf(start): defer sitemap dependencies until generation (#8533)
* perf(start): defer sitemap dependencies until generation

* Delete packages/start-plugin-core/tests/sitemap-import.test.ts

* perf(start): defer sitemap dependencies until generation [Self-Healing CI Rerun]

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-09-28 00:07:58 +02:00
Flo
60b8ad1ad0
perf(react-router): omit inactive route wrapper components (#8529)
* perf(react-router): omit inactive route wrapper components

* perf(react-router): omit inactive route wrapper components [Self-Healing CI Rerun]

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-09-27 22:02:22 +02:00
Flo
863c8a736b
perf(react-router): reuse link selector results (#8522)
* test(react-router): cover cached link selector reruns

* test(react-router): type configurable trailing slash fixture

* test(react-router): use type import in selector benchmark

* test(react-router): benchmark inactive dynamic destinations

* perf(react-router): reuse link selector results

* perf(react-router): resolve external links once per selector

* perf(react-router): shrink link state classification

* perf(react-router): shrink external link expression

* perf(react-router): shrink link state classification [Self-Healing CI Rerun]

* test(react-router): address link selector review cleanup

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-09-27 22:01:33 +02:00
Flo
ff66a03df4
perf(react-router): consolidate root match provider (CodSpeed experiment) (#8530)
perf(react-router): consolidate root match context provider
2026-09-27 21:31:39 +02:00
github-actions[bot]
f0e751d325
ci: Version Packages (#8497) release-2026-09-27-1408 @tanstack/react-start-server@1.167.45 @tanstack/router-cli@1.167.39 @tanstack/router-core@1.171.33 @tanstack/router-generator@1.167.39 @tanstack/router-plugin@1.168.41 @tanstack/router-vite-plugin@1.167.41 @tanstack/solid-router@1.170.37 @tanstack/solid-start-client@1.168.36 @tanstack/solid-start-server@1.167.43 @tanstack/solid-start@1.168.56 @tanstack/start-client-core@1.170.33 @tanstack/start-plugin-core@1.171.48 @tanstack/start-server-core@1.169.38 @tanstack/start-static-server-functions@1.167.38 @tanstack/start-storage-context@1.167.35 @tanstack/vue-router@1.170.36 @tanstack/vue-start-client@1.167.39 @tanstack/vue-start-server@1.167.43 @tanstack/vue-start@1.168.55 @tanstack/react-router@1.170.40 @tanstack/react-start-client@1.168.38 @tanstack/react-start-rsc@0.1.58 @tanstack/react-start@1.168.59
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-27 16:03:11 +02:00
Manuel Schiller
3cdd1af04b
fix(router-core): restore native scroll restoration on reload (#8519)
* test: cover scroll restoration lifecycle handoff

* test: remove temporary scroll lifecycle benchmark

* fix(router-core): hand native scroll restoration back on pagehide
2026-09-27 14:31:49 +02:00
Sarah Gerrard
488d046a90
perf(router,start): update Seroval to 1.6.7 (#8297)
* perf(router,start): update Seroval to 1.6.6

* perf(router,start): update Seroval to 1.6.7

* chore: update seroval to 1.6.7

seroval and seroval-plugins were pinned to ^1.6.2 while 1.6.7 is the
current release. The type surface is additive: two new options
(maxBase64Length, compactArrayBufferViews) and an isStream export.

Bundle (gzip): router-only scenarios unchanged; Start client bundles
grow 532-642 bytes from the upstream typed array and base64 handling.
react-start.minimal 98504 -> 99039 (+535).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-26 15:55:05 -07:00
Flo
7471fb8591
chore: update CodSpeed action and Vitest plugin (#8508) 2026-09-26 21:39:51 +02:00
Flo
1e113034bd
test: expand compiler correctness coverage (#8506)
test: port compiler correctness coverage from Yuku migration
2026-09-26 19:31:18 +02:00
Flo
0b377c2e5b
test: stabilize scroll regression page readiness (#8507)
test: wait for rendered pages in scroll race regression
2026-09-26 19:11:42 +02:00
Cyril Strone
763ac8b8ad
test(react-router): regression for #2072 router context invalidation (#8499)
* test(react-router): add invalidate context regression for #2072

* cover auth logout/login via RouterProvider context with router.invalidate();
* assert beforeLoad observes fresh context in the same event handler.

* test(react-router): drive #2072 login redirect via beforeLoad

* assert invalidating the active /login match triggers the guard redirect;
* drop the explicit router.navigate that bypassed invalidation.

* test(react-router): tighten auth invalidation assertions

* test(react-router): clarify login invalidation comment

* test(react-router): assert auth observations without redundant waits

---------

Co-authored-by: Sheraff <me@florianpellet.com>
2026-09-26 13:45:54 +02:00
Flo
bb4423e098
bench(client-nav): add React and Solid hydration scenarios (#8439)
* bench(client-nav): add React hydration scenario

* fix(benchmarks): await React hydration completion under instrumentation

* bench(client-nav): add Solid and Vue hydration scenarios

* ci: apply automated fixes

* bench(client-nav): split Vue hydration into a separate PR

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-09-25 20:43:16 +02:00
Flo
e81845ff1e
fix(start): parse path params before server route handlers (#8434) 2026-09-25 17:02:09 +02:00
Flo
f5ffd3884b
perf(router): skip unused link preload cleanup across adapters (#8436)
* perf(react-router): skip unused link preload cleanup

* perf(react-router): use timer-only cleanup for intent preloading

* Revert "perf(react-router): use timer-only cleanup for intent preloading"

This reverts commit b5f46eac5f.

* perf(react-router): skip unused link preload cleanup [Self-Healing CI Rerun]

* perf(solid-router,vue-router): skip unused preload cleanup

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-09-25 16:45:51 +02:00
Sarah Gerrard
76a7c0bfad
perf(start-client-core): avoid unused middleware array (#8353) 2026-09-25 07:34:47 -07:00
Flo
0c1b5e38de
fix(router-core): retire invalidated loader reservations (#8460) 2026-09-25 16:16:41 +02:00
github-actions[bot]
ddad69a4a4
ci: Version Packages (#8486) release-2026-09-23-1332 @tanstack/react-router@1.170.39 @tanstack/react-start-client@1.168.37 @tanstack/react-start-rsc@0.1.57 @tanstack/react-start-server@1.167.44 @tanstack/react-start@1.168.58
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-23 15:28:58 +02:00
Flo
73bfc153ee
perf(react-router): avoid redundant link hydration updates (#8435)
* perf(react-router): avoid redundant link hydration updates

* refactor(react-router): hide hydration flag behind internal overload
2026-09-23 14:00:26 +02:00
github-actions[bot]
fe7f1fd0e6
ci: Version Packages (#8477) release-2026-09-21-2024 @tanstack/react-start-rsc@0.1.56 @tanstack/react-start@1.168.57 @tanstack/solid-start@1.168.55 @tanstack/start-plugin-core@1.171.47 @tanstack/vue-start@1.168.54
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-21 22:20:15 +02:00
Caleb Zearing
222300b82f
fix(start-plugin-core): restore per route stylesheets on Windows (#8202)
fix(start-plugin-core): normalize rspack route module paths for the Start manifest

Co-authored-by: Caleb Zearing <calebzearing@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Manuel Schiller <6340397+schiller-manuel@users.noreply.github.com>
2026-09-21 22:15:10 +02:00
Flo
ac223be013
fix(benchmarks): limit targeted bundle reports to measured scenarios (#8456) 2026-09-17 11:46:56 +02:00
Flo
2fb7723230
perf(benchmarks): compress bundle-size outputs once (#8453)
* perf(benchmarks): compress bundle-size outputs once

* add link to readme in skill

* ci: apply automated fixes

* fix(benchmarks): persist timing flag in measurement command

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-09-17 11:19:08 +02:00
Flo
6faf2bf292
ci: skip benchmarks for package test-only PRs (#8463) 2026-09-17 10:26:33 +02:00
Flo
faec323dc5
fix(router-core): missing deepEqual signature changes in replace-equal-deep benchmark (#8462) 2026-09-17 10:05:30 +02:00
github-actions[bot]
84bde660a1
ci: Version Packages (#8457) release-2026-09-16-2153 @tanstack/react-router@1.170.38 @tanstack/react-start-client@1.168.36 @tanstack/react-start-rsc@0.1.55 @tanstack/react-start-server@1.167.43 @tanstack/react-start@1.168.56 @tanstack/router-cli@1.167.38 @tanstack/router-core@1.171.32 @tanstack/router-generator@1.167.38 @tanstack/router-plugin@1.168.40 @tanstack/router-vite-plugin@1.167.40 @tanstack/solid-router@1.170.36 @tanstack/solid-start-client@1.168.35 @tanstack/solid-start-server@1.167.42 @tanstack/solid-start@1.168.54 @tanstack/start-client-core@1.170.32 @tanstack/start-plugin-core@1.171.46 @tanstack/start-server-core@1.169.37 @tanstack/start-static-server-functions@1.167.37 @tanstack/start-storage-context@1.167.34 @tanstack/vue-router@1.170.35 @tanstack/vue-start-client@1.167.38 @tanstack/vue-start-server@1.167.42 @tanstack/vue-start@1.168.53
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-16 23:34:45 +02:00
Flo
ce10dcd4d9
perf(router-core): reduce replaceEqualDeep allocations (#8411)
* perf(router-core): reuse key buffers in replaceEqualDeep

* perf(router-core): reuse unchanged incoming objects

* perf(router-core): reuse existing search objects
2026-09-16 23:12:37 +02:00
Manuel Schiller
bbd2336b84
perf(router-core): split replaceEqualDeep into an equality scan and a copy phase (#8389)
* perf(router-core): split replaceEqualDeep into an equality scan and a copy phase

`replaceEqualDeep` compared and copied in one loop. Every entry, also on
the common all-equal path, paid for the copy bookkeeping (`copy ??=`,
`if (copy) copy[key] = n`), an `equal` flag and — for objects — a
`hasOwn.call(prev, key)` lookup, while arrays and objects shared the
same keyed accesses through `array ? i : keys[i]`, so every access site
saw both element and named keys.

The function now runs in two phases:

- Scan: walk `next` up to the first difference, sharing equal children
  on the way. Arrays and objects have their own loop, so each keyed
  access only ever sees one kind of key and nothing is allocated while
  entries keep matching. A key at the same position of both key lists
  is proven to be `prev`'s own key; only reordered keys still need
  `hasOwn`. When everything matched and the key counts agree, `prev` is
  returned.
- Copy: equality is ruled out, so the loop only builds the result. The
  scanned prefix is shared from `prev`, the first differing entry keeps
  the value the scan already computed, and the rest is resolved without
  any equality bookkeeping.

Only an object entry of `prev` can share anything, so the recursion is
guarded by a single `typeof` check; `null` and mismatched types return
`next`'s entry through the entry checks. `isPlainArray` is no longer
used here: the array check reuses the `Object.keys` result that the
scan needs anyway. Semantics are unchanged: pass-through for
non-enumerable keys and for symbol keys on `next`, null-prototype
copies, the depth limit and the SSR early return all stay as they were,
and the tests pass against both implementations.

Bundle size (`benchmark:bundle-size`, gzip): react-router.minimal -1 B,
react-router.full -18 B, all 18 scenarios net -110 B (13 down, 5 up,
max +20 B on react-start.full for identical code).

Paired runs against the previous version (hz medians of 3 runs,
1000 calls per iteration; the machine was under load, so single-digit
differences are noise):

  equal flat search                          5.96k -> 6.98k  (+17%)
  equal nested search                        2.47k -> 2.83k  (+14%)
  equal array of objects                       524 ->   579  (+10%)
  equal long primitive array (1024)             49 ->    69  (+39%)
  long primitive array, last item changed       37 ->    41  (+11%)
  wider flat object (64 keys), last changed    218 ->   229   (+5%)
  flat search, one changed leaf              5.31k -> 5.59k   (+5%)
  array of objects, one changed item           483 ->   513   (+6%)
  flat search, all leaves changed            5.29k -> 5.35k   (+1%)
  array of shared objects, one changed       1.61k -> 1.44k  (-10%, ±29%)

Entries that change between an object and a primitive now pay one
recursive call instead of an inline four-way type check; guarding both
sides costs more bundle bytes than this branch is worth.

Adds tests for the scan/copy boundary (equal children and next-only
keys after the first difference, reordered keys, object/primitive
transitions, shorter and longer arrays, a change in the last of 1024
entries, the depth limit) and bench cases for the shapes that told the
candidate implementations apart.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(router-core): keep sparse arrays with extra keys opaque in replaceEqualDeep

The plain-array check compares `Object.keys(array).length` with
`array.length`. A hole and an extra enumerable key cancel out in that
count, so `Object.assign([1, ,], { extra: 'x' })` was admitted: the
index-based copy dropped `extra` and turned the hole into an explicit
`undefined`, and an index-wise equal `prev` was returned for it. The
same blind spot exists in the exported `isPlainArray`, which the
previous implementation used for this check.

Extra string keys always sort after the index keys, so once the count
matches, `next` is a dense index-only array exactly when its last key
is its last index. That is one string comparison per array instead of
a per-key validation, and it stays inline with the existing count
check. `prev` keeps the count check only: a result is either a copy
built from `next`'s entries or `prev` itself, which the caller already
holds.

Symbol keys on arrays stay admitted, as before this stack: checking
them costs an `Object.getOwnPropertySymbols` call per array pair, which
measured ~8% on the equal nested search shape (a record holding a
four-element array), and `react-router.minimal` +3 B on top of the
+13 B gzip of this fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-16 23:12:36 +02:00
Manuel Schiller
01035782e5
perf(router-core): skip symbol enumeration for plain replaceEqualDeep inputs (#8364)
Every object pair `replaceEqualDeep` visited paid for three native key
lookups per side: `Object.keys`, `Object.getOwnPropertyNames` (to detect
non-enumerable props) and `Object.getOwnPropertySymbols`. Measured on a
4-key literal the first two cost 7.6 ns and 10 ns, the symbol lookup
34 ns — 31 ns even on `{}` — so two thirds of the enumeration cost went
into a key type that router data never carries. (`Reflect.ownKeys` as a
single replacement call was tried and is 100 ns.)

Symbol keys and non-enumerable keys still have to be handled correctly:
Apollo's `preloadQuery` refs carry symbol keys and broke under
`defaultStructuralSharing` when copies dropped them (#4237). Instead of
comparing and copying such objects key by key, they are now opaque: an
object with non-enumerable own keys on either side, or symbol keys on
`next`, makes `next` pass through untouched. That keeps both guarantees
that matter — no partial copy, no stale `prev` returned for it — and only
gives up structural sharing for those objects.

`prev` is not scanned for symbols on purpose. It is normally an earlier
`next`, so a symbol-carrying `prev` meets a symbol-carrying `next` and the
`next` check fires; a symbol-carrying `prev` with a symbol-free, otherwise
equal `next` returns `prev` (covered by a test). Plain objects are now
compared and copied by `Object.keys` alone, and `getEnumerableOwnKeys`
is gone.

Paired runs against the previous version (hz, 1000 calls per iteration):

  equal empty objects             14.8k -> 18.3k  (+24%)
  equal empty null-proto objects   5.1k ->  6.3k  (+24%)
  equal flat search                7.3k ->  8.2k  (+12%)
  flat, one changed leaf           6.1k ->  6.9k  (+12%)
  equal nested search              3.0k ->  3.1k   (+4%)
  nested, sharing subtrees         2.6k ->  2.7k   (+7%)
  equal array of objects            609 ->   729  (+20%)
  array, one changed item           551 ->   640  (+16%)
  wide (12 keys) changed, null-proto 1.8k -> 2.0k  (+9%)

Tests now document the pass-through contract for symbol-keyed objects,
including the deliberate `prev`-only asymmetry.
2026-09-16 23:12:36 +02:00
Manuel Schiller
cecae5440b
perf(router-core): check plain objects by constructor (#8363)
* perf(router-core): check plain objects by constructor

`isPlainObject` gates every recursion step of `replaceEqualDeep` and
`deepEqual`, so it runs at least twice per object pair, on every nested
level, on every navigation and Link build. The previous implementation
(copied from `is-plain-object`) called `Object.prototype.toString` on the
value and again on its constructor's prototype, plus a `hasOwnProperty`
lookup: up to four `toString` dispatches per compared pair, most of them
spent confirming that `{}` is a plain object.

The check is now a single expression:

  !!o && typeof o === 'object' && (o.constructor ?? Object) === Object

Object literals, `JSON.parse` output and `Object.create(literal)` inherit
`Object` as their constructor; `Object.create(null)` objects (the router's
search and params objects) have none, which `?? Object` accepts. Class
instances, arrays, `Map`, `Date`, functions and primitives fail it, as
before. The only accept-set differences are objects from another realm
(an iframe's `Object` is not `===` ours) and objects with a custom
`Symbol.toStringTag`; neither occurs in router state.

Paired runs against the previous version (hz, 1000 calls per iteration):

  deepEqual equal empty objects         25.6k -> 59.4k  (+132%)
  deepEqual nested, one changed leaf    11.3k -> 22.8k  (+102%)
  deepEqual equal flat (partial)        23.0k -> 39.7k   (+73%)
  replaceEqualDeep equal empty objects  10.6k -> 14.9k   (+40%)
  replaceEqualDeep equal array of objs    489 ->   604   (+24%)
  replaceEqualDeep equal nested          2.4k ->  2.8k   (+19%)
  replaceEqualDeep equal flat search     6.0k ->  7.0k   (+17%)

Adds an accept/reject table for `isPlainObject` and checks that class
instances stay opaque to structural sharing while null-prototype and
literal objects compare as equal.

* fix(router-core): keep records with a constructor key plain

`?constructor=foo` decodes to an own `constructor` data key on the
null-prototype search record, and `(o.constructor ?? Object) === Object`
read that key. Such records (and the `{ ...search }` copies of them) were
classified as non-plain, so `replaceEqualDeep` handed back `next` without
sharing and `deepEqual` reported them unequal.

Keep the constructor comparison as the fast accept: it is an inline-cache
load for literals and null-prototype records and is what the PR's speedup
comes from. When `constructor` is anything else, consult the actual
prototype instead of rejecting: `null` or one whose `constructor` is
`Object` means a record, anything else a class instance. The prototype
lookup is a builtin call (~6ns in megamorphic optimized code), so running
it unconditionally would return most of the gain: median hz over 3
rotated rounds, `replaceEqualDeep` equal empty 10.9k -> 8.6k (-21%),
equal array of objects 470 -> 386 (-18%), `deepEqual` equal empty
58.0k -> 35.9k (-38%). With the fallback only on the mismatch path the
hot cases stay within noise of the shortcut and the constructor-key
cases now do the sharing work at the same cost as other null-prototype
records. `react-router.minimal` gzip is +15 B against the shortcut and
still 44 B below the `toString` implementation.

Benchmarks the predicate directly (literal, null-prototype record, record
with a constructor key, class instance) and sharing of a search record
that carries a constructor key. Tests both record shapes and parser
output, all `constructor` value types, and that a class instance with an
own `constructor` key stays opaque.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-16 23:12:35 +02:00
Manuel Schiller
84936cc045
perf(router-core): allocate replaceEqualDeep copies lazily (#8362)
`replaceEqualDeep` runs on every navigation and Link build: search,
params, state and loader data all go through it, and in the common case
`next` turns out to be deeply equal to `prev`. Until now the function
still allocated the result object (or array) up front and filled it key
by key while comparing, only to throw it away and return `prev`.

The copy is now created at the first difference. Everything compared
before that point is known to be equal and is taken from `prev` in one
pass (`copyItems`), so unchanged subtrees are shared exactly as before.
When nothing differs, nothing is allocated; when only the key sets
differ, the copy is built after the loop.

Smaller changes in the same function:

- deep equality is a single `equal` flag instead of a matched-key count
  compared against the sizes afterwards; once unequal, the `hasOwn`
  check for keys that only `next` has is skipped
- `nullReplaceEqualDeep` passes a boolean instead of an object factory,
  so the plain variant no longer evaluates a default `() => ({})` per
  call and the copy site has no indirect call
- an overload signature keeps the generic return type without the
  `_next` alias in the emitted code
- `getEnumerableOwnKeys` loops over `getOwnPropertySymbols` directly;
  an empty loop needs no early return

`tests/replace-equal-deep.bench.ts` was added first, with the shapes the
router feeds these helpers. Paired runs against the previous version
(hz, 1000 calls per iteration):

  equal empty objects        10.0k -> 10.6k   (+6%)
  equal flat search           5.3k ->  5.9k  (+12%)
  equal nested search         2.2k ->  2.4k  (+13%)
  equal array of objects       445 ->   485   (+9%)
  flat, one changed leaf      5.4k ->  5.2k   (-3%)
  wide (12 keys) changed      2.4k ->  2.2k  (-11%)

The equal paths win and allocate nothing; the copy paths pay for the
extra call and the per-key `copy` check.
2026-09-16 23:12:34 +02:00
github-actions[bot]
de023a7533
ci: Version Packages (#8429) release-2026-09-16-2114 @tanstack/react-router-ssr-query@1.167.3 @tanstack/react-router@1.170.37 @tanstack/react-start-client@1.168.35 @tanstack/react-start-rsc@0.1.54 @tanstack/react-start-server@1.167.42 @tanstack/react-start@1.168.55 @tanstack/router-cli@1.167.37 @tanstack/router-core@1.171.31 @tanstack/router-generator@1.167.37 @tanstack/router-plugin@1.168.39 @tanstack/router-ssr-query-core@1.169.3 @tanstack/router-vite-plugin@1.167.39 @tanstack/solid-router-ssr-query@1.167.3 @tanstack/solid-router@1.170.35 @tanstack/solid-start-client@1.168.34 @tanstack/solid-start-server@1.167.41 @tanstack/solid-start@1.168.53 @tanstack/start-client-core@1.170.31 @tanstack/start-plugin-core@1.171.45 @tanstack/start-server-core@1.169.36 @tanstack/start-static-server-functions@1.167.36 @tanstack/start-storage-context@1.167.33 @tanstack/vue-router-ssr-query@1.167.3 @tanstack/vue-router@1.170.34 @tanstack/vue-start-client@1.167.37 @tanstack/vue-start-server@1.167.41 @tanstack/vue-start@1.168.52
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-16 23:07:33 +02:00
Manuel Schiller
cbbfbe37ab
optimize streaming (#8204) 2026-09-16 22:38:25 +02:00
Manuel Schiller
1ca361ba52
refactor(router-core): parse masked locations without mutating shared state (#8421)
* refactor(router-core): parse masked locations without mutating shared state

`parseLocation` built the presented location of a masked entry by parsing
the stored `__tempLocation` and then patching and `delete`-ing keys on the
resulting `state`, which `replaceEqualDeep` may have shared with the
previous location, before spreading the result once more. The inner parser
now takes the state to use, so the masked branch passes the intended state
up front and assigns `maskedLocation` on the fresh object.

The slow parsing path only runs the input rewrite when one is configured,
and `resolvePathWithBase` is inlined into its two callers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit cc6159628cd22faf9c16e6e432cb35093b2826a8)

* refactor(router-core): remove redundant input rewrite guard

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-16 00:42:50 +02:00
Manuel Schiller
a1c8d1aa75
perf(router-core): pass resolvePath arguments positionally (#8419)
`resolvePath(base, to, trailingSlash?, cache?)` replaces the options object,
so `resolvePathWithBase` — called from `buildLocation` and `matchRoute` —
no longer allocates per path resolution. `resolvePath` is an internal
helper. react-router.minimal shrinks by 17 B gzip (60 raw).


(cherry picked from commit de7bc72a952aaf77bbedfd4453a4d12edadaad53)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-16 00:42:50 +02:00