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

6,679 commits

Author SHA1 Message Date
Manuel Schiller
cb8749e9fc
perf(vue-router): remove redundant match fragment (#8326)
Remove the inner Fragment around scroll restoration while retaining the
outer Fragment, script/null condition and fresh shell-slot VNodes. Cover
child state across shell updates/invalidation and SSR script selectors/nonces.

Native malloc profiling on macOS arm64, Node 24.8.0, with the existing
CodSpeed flags, seven preparation calls and three fresh final captures:
- Interrupted peak after middleware split: 733736 -> 295024 bytes (-59.79%).
- Navigation peak after middleware split: 420776 -> 420896 (+120 bytes).
- Composed vs f2530bf453: interrupted -59.79%, navigation -19.32%,
  unique-location churn effectively unchanged (-0.016%).
These are local native measurements, not a Linux CodSpeed CI result.
Navigation end-of-region outstanding malloc increases 12472 bytes versus
the middleware-only control; this endpoint is before teardown, not retained
JS heap. Total allocated native bytes decrease.

Standalone Vue canonical Link CPU: 5.32037 -> 5.30865 ms/batch,
-0.22% [-4.04%, +3.75%], inconclusive across four isolated process pairs.
Incremental gzip: Vue Router minimal/full +1/+1 byte, Vue Start 0/-2.
All four Vue bundles remove 12 raw bytes; other 14 fixtures are identical.
No benchmark flags, workload counts, public APIs or features changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:04 +02:00
Manuel Schiller
700a714c5f
perf(router-core): reduce navigation allocations (#8325)
* perf(router-core): cache canonical interpolated pathnames

Store the existing canonical decoder's pathname in the route interpolation cache so hits do not decode it again. Keep the standalone interpolation kernel, static/leaveParams paths, non-string fallbacks, cache capacities and decoder/template invalidation unchanged. Cover cold/hit href parity, reserved encodings and coercion fallback.

Against 3905181fd4, four balanced isolated-process pairs reduced encoded-destination client CPU 13.42% (95% CI -14.50% to -12.32%) and wall 13.32% (-14.44% to -12.19%). Shared params CPU improved 1.27% (-2.39% to -0.14%); unique/miss-heavy CPU +0.49% (-0.35% to +1.33%) was inconclusive. Four paired SSR repetitions improved encoded CPU 14.13% (-19.70% to -8.18%) and wall 14.17% (-19.83% to -8.12%).

React Router minimal/full gzip +4/+5 bytes to 85791/89378. Across all 18 fixtures gzip deltas range -7 to +16 bytes. The private microbenchmark now names its normalized-output contract; its changed-scope timings are not used for the speedup claims.

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

* perf(router-core): reuse lightweight raw-param snapshots

getMatchedRoutes already copies cached raw params. Reuse that owned snapshot for lightweight parsing instead of allocating another dictionary. Preserve state-param reuse and matcher cache ownership. Cover mutating/throwing live parsers and add an opt-in cold-source location benchmark.

Against ac2ac45367, the same 256-build cold-location benchmark observed client means 0.3434 to 0.2987 ms for one param, 0.7437 to 0.4638 ms for eight, and 1.8625 to 1.1565 ms for 32. Before/after RMEs were 5.15/5.47%, 8.10/4.14%, and 2.37/2.97%. These are cold-mechanism results, not a 38% application speedup; small server cases were noisy and four paired application relative/numeric cases were inconclusive.

React Router minimal/full gzip decreases 6/9 bytes to 85786/89376; raw -35. All 18 fixture gzip deltas range -11 to +1 bytes. No public API, parser behavior or cache capacity changed.

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

* perf(router-core): reduce middleware compilation memory

Separate search middleware collection from recursive execution so Maglev
does not build one large compiler graph for both. Preserve live route-option
reads, ordering, validation, legacy filters and the empty-search fast path.
Cover middleware replacement/removal across a previously used route branch.

Native malloc profiling on macOS arm64, Node 24.8.0, using the existing
CodSpeed flags and seven preparation calls (three fresh processes):
- Vue navigation peak: mean 521664 -> 420776 bytes (-19.34%).
- Vue interrupted-navigation peak: 733736 -> 733736 bytes (unchanged).
These are local native allocations, not a new Linux CodSpeed CI run.

Four paired React Link replicas: relative client CPU -2.79%
[-4.37%, -1.18%]; shared/updater/middleware cases are inconclusive.
Isolated SSR CPU means range -1.63% to +1.28%, all inconclusive.
React Router minimal/full gzip: +15/+16 bytes; all 18 gzip deltas -6..+20.
Keep all benchmark JIT/GC flags and operation counts unchanged.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:04 +02:00
Manuel Schiller
6387d581ea
perf(react-router): reduce Link runtime allocations (#8324)
* perf(react-router): filter native Link props once

Omit type and disabled in one rest copy for native anchors instead of copying the hook result twice. Custom components still receive disabled, and useLinkProps still returns supported type/disabled values. Add client/SSR coverage for those distinctions, refs and render-function children.

Against 6e4584e0d8, four balanced fresh-process pairs with one implementation per process reduced client parameter-updater CPU from 15.61515 to 15.14615 ms per eight-navigation batch (-3.00%, 95% CI -4.19% to -1.80%); wall -3.04% (-4.29% to -1.78%). SSR shared-param CPU fell from 1.45208 to 1.41006 ms per four-request batch (-2.89%, CI -3.80% to -1.98%); wall -2.85% (-3.84% to -1.84%). Earlier co-loaded comparisons were inconclusive.

React Router minimal gzip -5 bytes to 85773; full +1 to 89358. Other React fixtures vary -3 to +4 bytes, raw +14; Solid/Vue remain byte-identical. No public API or prop functionality removed.

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

* perf(react-router): stabilize hydration snapshot getters

Reuse the existing true/false snapshot functions instead of allocating them on every useHydrated render. This lets React skip unnecessary store-instance passive bookkeeping without changing hydration values or adding hooks. Cover stable identities and an actual server-render/hydrateRoot transition.

Against b6971a434a, four balanced fresh-process pairs per case (200 warmup and 500 measured eight-navigation batches) reduced parameter-updater CPU from 15.16880 to 14.99436 ms (-1.15%, 95% CI -1.84% to -0.46%); wall -1.05% (-1.62% to -0.47%). Middleware CPU fell from 15.23708 to 14.81729 ms (-2.75%, CI -4.46% to -1.01%); wall -2.79% (-4.53% to -1.01%).

React Router minimal/full gzip increases 14/15 bytes for this isolated fix, remaining below the initial branch baseline. All Solid/Vue bundle output is unchanged. Public APIs, server snapshots and client hydration transitions are preserved.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:03 +02:00
Manuel Schiller
9a356d7505
test(benchmarks): profile unmodified React Link bundles (#8323)
Keep comparison snapshots in SWC's existing node_modules exclusion so emitted JavaScript is not retranspiled and source-map positions remain valid. Preserve asynchronous ESM loading and add a failing-before source-integrity regression.

Four-replica identical-bundle calibration: client shared-params CPU +0.92% [-4.14%, +6.24%], wall +1.03% [-4.55%, +6.93%]; SSR CPU +0.17% [-6.32%, +7.11%], wall +0.15% [-6.44%, +7.21%]. Intervals include zero; no speedup is claimed. Production code is unchanged; baseline React Router gzip is 85797/89379 bytes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:03 +02:00
Manuel Schiller
d76a33284b
perf(router-core): consolidate interpolation caches (#8321)
* refactor(router-core): consolidate path interpolation

Remove the object-returning internal wrapper and keep one interpolatePath returning a pathname with optional metadata outputs. Migrate router, devtools, tests, and benchmarks while leaving parsing and cache limits unchanged.

Devtools requests only missing-param status. Tests use direct expected paths and explicit metadata; cache benchmarks no longer carry obsolete factory compatibility dispatch.

React Router minimal/full gzip are 85829/89413 bytes (+5/+4 from 8a9f57e638, still 14/4 below measured main). Full units/types/exports and 76 browser cases pass; eight paired client/SSR workloads show no supported timing change.

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

* perf(router-core): keep derived caches on routes

Store branches and interpolation plans directly on route objects. Use the already-resolved destination route, remove the fixed outer limit for registered templates, and retain128 results per route. Keep a bounded32-template fallback for arbitrary templates and masks.

Build/install route-tree indexes and string caches as one bundle for existing SSR reuse. Reinitialization clears ancestor branches; interpolation plans validate their exact template and decoder without unconditional resets. Loaded match data remains request-local.

Against29509b9b98, paired core buildLocation batches over64/256 templates use40-43% less CPU; four fresh server routers generating200 hrefs each use8-9% less. Reversed import order corroborates these scoped results. Four real client/SSR Link cases remain statistically inconclusive.

All18 bundle fixtures shrink19-37 gzip bytes versus the consolidation baseline. React Router minimal/full are85797/89379 bytes,46/38 below measured main. Tests cover SSR request cleanup, route reuse, decoder/trailing variants, reparenting, result bounds and fallback capacity.

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

* test(router-core): add opt-in matching interpolation benchmarks

Cover client/server matching with cold and Link-primed route plans, nested params, high-cardinality misses, optional params, and splats. Gate all additional cases behind TSR_LINK_PERF=1.

Evaluate six matching-cache prototypes without retaining production changes. Eager variants regress repeated misses by24-64%. Read-through reuse improves warm matching microcases but adds65 gzip bytes; all26 application Link/SSR comparisons show no supported speedup, with one relative-Link slowdown. Real HTTP SSR ABBA means differ by only -0.41%, within observed variation.

Restore production and all18 bundle metrics exactly to ec05cc6bec. Preserve detailed measurements and rejected prototypes in session artifacts and uncommitted LOG.md.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:03 +02:00
Manuel Schiller
f151ab018e
perf(router-core): compact navigation parameter resolution (#8328)
Declare the native null-prototype target once for non-inheriting parameter modes. Preserve updater isolation, native copy counts, and literal-parameter merge behavior. Group parameter resolution with search middleware without changing Link or path interpolation logic.

Official current-branch bundles shrink in all 18 scenarios by 2-30 gzip bytes versus 9c7cab48c1. React Router minimal: 85778 -> 85748 (-30); full: 89386 -> 89384 (-2).

A matched-main preview against cf166d160e measures React Router minimal at 85805 versus main 85821 (-16), and full at 89385 versus main 89398 (-13). Eight of nine matched-main React fixtures meet main; Start+Query remains +25 bytes. Small Solid overages are retained as agreed.

Eight paired client/SSR cases with four independent replicas each detected no supported timing regression or improvement. Add coverage for fresh updater copies, null prototypes, inheritance, and clearing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:02 +02:00
Manuel Schiller
873c830ccb
refactor(router-core): clarify segment interpolation (#8319)
Organize the generic interpolation loop into static, wildcard, and named-parameter behavior blocks. Keep one shared key lookup, one encoding step, and one prefix/value/suffix assembly. Name affix boundaries and keep optional/missing wildcard behavior local to its segment type.

Replace the self-clearing onMissing callback with an optional metadata result object. The public interpolatePath wrapper reuses its existing result object; pathname-only callers still allocate no metadata. Preserve one parameter read, the reusable parser buffer, absent optional cache keys, canonical and legacy splat metadata, and public return values. Fast-path empty splat strings before the URL-safe regex so sharing the encoding step does not penalize omitted values.

Final official gzip measurements versus 5017a72614:
- React minimal: 85771 -> 85769 (-2 bytes).
- React full: 89384 -> 89382 (-2 bytes).
- All 18 fixtures range from -4 to +8 bytes; no unrelated source changes compensate for interpolation cost.

Added mixed-type/affix metadata coverage and direct pathname-kernel benchmarks. Paired fixed-seed CPU measurements of the real parent/current modules show effectively flat required client pathname interpolation (+0.04%) and 0.37-4.14% lower time in the other sampled required/optional/splat/mixed/missing client/server combinations. These are focused kernel diagnostics, not a broad application speedup claim.

Preserve the experiments, rejected larger variants, full fixture metrics, and raw benchmark output in uncommitted LOG.md and session artifacts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:02 +02:00
Manuel Schiller
9b2adaf8c3
perf(router): optimize Link state props across frameworks (#8318)
* perf(router): compact Solid and Vue Link state props

Port the React Link bundle-size reductions to Solid and Vue: share exact/fuzzy pathname normalization, resolve only the selected active/inactive props, concatenate classes without temporary arrays, and avoid style allocation when neither source supplies styles. Vue forwards and visits one selected props object in both client and SSR paths.

Keep framework-specific behavior: Solid retains its default-styling fast path and base href/handler precedence; Vue retains state-prop overrides and zero-argument callbacks. Both keep style snapshots so mutable Solid stores and Vue proxies remain reactive, including additions to empty style objects. No public API or unrelated production code changes.

Official gzip measurements versus d4cc307869:
- Solid minimal: 34017 -> 33973 (-44 bytes).
- Solid full: 38973 -> 38930 (-43 bytes).
- Vue minimal: 50731 -> 50646 (-85 bytes).
- Vue full: 56484 -> 56395 (-89 bytes).
All nine Solid/Vue Router/Start fixtures shrink by 26-104 gzip bytes; all nine React fixtures remain byte-identical.

Independent hunk attribution: active pathname checks save 36/41 Solid and 37/34 Vue bytes. State-prop changes alone save 0/2 Solid and 46/53 Vue bytes. Combined gzip deltas are not additive.

Existing 200-Link/eight-navigation workloads were compared with frozen parent, props-only, and final bundles. Standalone wall-time runs were too variable for a speed claim. Interleaved fixed-seed checks, repeated with reversed module order, showed effectively flat rendering cost: Solid mean CPU -1.49% / +0.33%, Vue -0.23% / -0.29%; corresponding wall changes -1.81% / +0.50% and -0.12% / -0.33%. No incremental rendering speedup is claimed. Raw results and experiments remain in uncommitted LOG.md and session artifacts.

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

* fix(router): honor Link state props and Vue class bindings

Apply selected active/inactive props after ordinary base props in Solid and React, including React server output. Preserve the dedicated class concatenation and style merge handling. Add client/server regressions for supported refs and event handlers; do not widen the state-prop API to router navigation options.

Keep Vue object and nested-array class values intact instead of interpolating them into strings. Compose base/state values with Vue-compatible arrays, retain omitted-class behavior, and clone props at VNode creation because Vue normalizes class values in place. This preserves cached bindings and later reactive class changes. Vue ordinary state-attribute precedence was already correct and is left unchanged.

The regressions were run on the pre-fix implementations and failed for the reported behaviors, then passed after the fixes. Full framework unit/type/lint/package and Chromium coverage passes. Bundle impact remains small: React/Solid raw bytes unchanged; Vue Router minimal/full are 14/10 gzip bytes smaller. Detailed red/green evidence and measurements are kept in uncommitted LOG.md and session artifacts.

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

* fix(solid-router): preserve computed Link routing props

Restore the computed href, target, and disabled values after active/inactive state props. Keep state-prop ref/event overrides, class/style composition, and the default styling fast path unchanged for client and SSR rendering.

Reproduce the history/rewrite href failures and extend existing state-prop regressions to cover conflicting routing fields. Full validation passes 922 client tests (one skipped), 33 server tests, type/lint/export checks, and 24 Chromium cases.

The full bundle matrix adds 16/13 gzip bytes to Solid Router minimal/full and 13-17 bytes to Solid Start fixtures. React and Vue bundles are unchanged; no extra allocations or href recomputation are introduced.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:01 +02:00
Manuel Schiller
94f6c14f6b
test(router): add stable Link performance benchmarks (#8317)
* test(router): add opt-in React Link performance cases

Add 13 shared typed workloads measured through production client navigation and real SSR rendering: shared/unique params, updater functions, inheritance, relative targets, middleware chains, numeric parse/stringify, optional/splat segments, encoding, masks, rewrites, and active props with structured search and style merging.

Keep all 26 benchmarks outside the existing client-nav/SSR aggregate projects and CodSpeed build graph. The dedicated @benchmarks/react-link-performance targets require TSR_LINK_PERF=1 for discovery; disabled suites import no app. Gate tests cover explicit enablement and production environment selection.

Client batches perform eight navigations with 200 persistent measured Links. SSR batches create/load/render/dispose four fresh routers. Independent href, active-state, style, and history-state updater assertions run outside the measured loops. No production packages or dependencies change.

Compared identical sources on origin/main 28a5e4504e and captured HEAD bbaa7b3f29, with two fresh processes per ref/mode in counterbalanced order, 50 warm-up iterations, and 3-second windows. Full-suite results show lower HEAD client times for most cases (10.6% shared params, 13.2% search/hash/state updaters, 17.1% masks); SSR updater and optional cases show 14.8% and 12.4% reductions. These are whole-ref comparisons, not improvements from this benchmark-only commit.

Run-to-run noise is significant for small differences. Initial middleware and unique-param SSR slowdowns reversed in focused reruns, so they are not established regressions. Preserve both full-suite and focused data in the uncommitted experiment log and session artifacts.

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

* test(router): stabilize opt-in Link performance comparisons

Bound control navigation history with replace and assert that the measured anchors remain mounted. Share the exact setup, batch, and post-measurement assertions between normal Vitest benches and the paired comparison runner. Increase normal warm-up and measurement windows.

Add an opt-in stable runner with a fresh process per case/replica, separate router/app modules, one shared production React runtime, deterministic V8 random/hash seeds, alternating initialization order, and ABBA/BAAB fixed-work blocks. Record main-thread CPU, wall time, whole-process CPU, bundle hashes, and all raw blocks. Derive per-case 95% intervals from independent process replicas rather than correlated individual batches; require CPU and wall results to corroborate a direction.

Same-code controls exposed substantial noise in earlier methods. The selected control was centered near zero (client CPU -0.95%, SSR CPU -0.56%), with intervals still several percentage points wide. Keep unresolved measurements explicitly inconclusive instead of labeling them regressions.

Compared fixed runtime refs origin/main 28a5e4504e and bbaa7b3f29 across all 26 cases with four fresh-process replicas each: 16 cases support speedups, 10 remain inconclusive, and none support a slowdown in both metrics. Client middleware CPU: -5.95% [-13.89%, +2.73%]; SSR middleware: -16.06% [-31.65%, +3.09%]; SSR unique params: -5.08% [-14.97%, +5.96%]. These do not establish middleware or unique-param regressions.

No production package code or default CodSpeed workflow changes. Keep the complete raw matrix, calibration trials, snapshots, and detailed conclusions in uncommitted session artifacts and LOG.md.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:01 +02:00
Manuel Schiller
7e349c3071
perf(router): share Link pathname interpolation (#8252)
* perf(router-core): share pathname interpolation across Links

Reuse the existing segment parser to prepare parameter-name lists. Share pure interpolated path strings through bounded router-scoped SIEVE caches (32 templates, 128 paths per template). Avoid compound-key allocation for single-parameter templates and reuse the current template plan.

Parameter callbacks still run before interpolation. Search, hash, state, masks, rewrites, and active-state handling remain independent. Decoder changes clear the caches. No per-Link result cache, descriptor checks, new route matcher, or public API change.

React Link rendering benchmark, measured separately for this commit
and its parent using exact production builds:
- Workload: benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  (200 persistent Links, eight navigations per measured batch).
- Apple M4, Node 24.20.0, Vitest 4.1.4, NODE_ENV=production.
- 8 fresh parent processes and 4 fresh processes for this commit,
  each with warmupIterations=50 and time=10000 ms;
  counterbalanced run order.
- Parent mean times (ms): 3.8767, 3.8900, 4.5507, 4.0116, 3.8297, 3.8582, 3.8879, 4.0157.
- This commit mean times (ms): 2.8824, 2.8625, 2.9597, 2.9673.
- Median run means: 3.8889 -> 2.9211 ms.
- Incremental effect: 24.89% less time; throughput change +33.13%.
- Largest within-run RME for this revision: 1.15%.

Incremental minimal/full React gzip impact: +251/+265 bytes.
Benchmark sources and commit implementation trees are unchanged.

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

* test(router-core): cover shared interpolation cache workloads

Cover missing optional parameters that become present, canonical splat keys, and the public usedParams shape. Add focused hit, eviction, and mixed-input benchmarks before simplifying cache metadata collection.

Current cache baseline on Node 24.20.0: repeated single-param batches average 0.0050 ms, repeated multi-param batches 0.0305 ms, result eviction 0.1568 ms, template eviction 0.0809 ms, and mixed inputs 0.0370 ms. Miss-heavy runs show outliers and require narrower comparisons. Production cache remains unchanged.

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

* perf(router-core): reuse interpolation pass for cache keys

Collect cache parameter names during the existing interpolation pass instead of parsing each new template twice. Reuse the first interpolated result, compact template plans, and share required/optional/splat path assembly. Preserve public interpolation metadata, missing-param behavior, decoder invalidation, and bounded router-local caches.

Fresh existing React Link benchmark against parent cd4010d9cb, Apple M4 / Node 24.20.0 / Vitest 4.1.4 / production:
- 200 persistent Links and eight navigations per batch. Four separate processes per version, counterbalanced order, warmupIterations=50, time=10000 ms.
- Parent means: 3.0527, 2.8610, 2.8329, 2.8729 ms.
- This commit means: 3.1291, 2.8745, 2.8849, 2.8552 ms.
- Median run means: 2.8670 -> 2.8797 ms (+0.44% time, effectively flat; no incremental Link speedup claimed). Within-run RME below 1%.
- Fresh original-baseline comparisons: 4.2143 -> 2.9825 ms (-29.23%) and 4.0561 -> 2.9909 ms (-26.26%). The complete series still exceeds the original 20% target.

Focused interpolation benchmarks, same files/inputs before and after:
- Client uncached single-param batches: 90.51 -> 79.91 us (-11.7%).
- Client cached template eviction: 72.33 -> 49.74 us (-31.2%; 4-6% RME, p75 also improves).
- Client uncached mixed batches: 71.10 -> 52.41 us (-26.3%).
- Server uncached mixed batches: 61.42 -> 38.11 us (-38.0%).

Bundle size: React minimal/full -414 raw bytes each and -55/-68 gzip bytes. All 18 Router/Start fixtures shrink by 48-75 gzip bytes. Independent hunk attribution confirmed reductions for every retained group.

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

* perf(router): meet the original Link bundle budgets

Move the bounded pathname cache onto RouterCore and reuse one interpolation traversal for pathname generation, cache keys, and optional public metadata. Remove the factory and per-parameter metadata callbacks, preserve decoder invalidation and development server/client overrides, and simplify React Link active-state and state-prop assembly. Public APIs and routing features remain unchanged.

Official gzip measurements against parent 37bd31e4e2:
- React minimal: 86000 -> 85772 bytes (-228), equal to origin/main.
- React full: 89601 -> 89356 bytes (-245), 6 below origin/main.
- All 18 Router/Start fixtures shrink by 130-245 gzip bytes. Link remains included; fixtures and the existing Link workload are unchanged.
- Independent Link-only changes save 78/86 bytes; core-only changes save 174/169. Combined gzip effects are not additive.

Fresh existing production Link benchmark, Apple M4 / Node 24.20.0 / Vitest 4.1.4: 200 persistent Links, eight navigations per batch, 50 warm-up iterations and 10-second measurements, with separate processes in counterbalanced order.
- Parent means: 2.903316, 2.908833, 2.945163, 2.955386 ms.
- This commit means: 2.941129, 2.941699, 2.920172, 2.970072 ms.
- Median run means: 2.926998 -> 2.941414 ms (+0.49% time, near process-to-process noise; no incremental Link speedup claimed). Maximum within-run RME: 0.84%.
- Fresh original-baseline comparison: 4.283454 -> 3.016571 ms (-29.58% time). This is the whole-series improvement, not the incremental effect of this commit.

Identical focused before/after benchmarks show public helper regressions eliminated, server public families 4.68-12.85% faster, and cached mixed/missing cases 6.50-10.43% faster. Removing the redundant last-template shortcut makes isolated single-template cache hits slower (5.93 -> 7.21 us client per 200 calls; 5.99 -> 6.83 us server). The real Link workload remains effectively flat for this size-reduction step.

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

* perf(router-core): cache omitted optional path params

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-13 13:55:01 +02:00
Sarah Gerrard
ae68535929
perf(history): avoid generating unused location keys (#8349) 2026-09-12 13:19:37 -07:00
Flo
8fff7fa1f2
fix(history): normalize memory history hrefs (#8359) 2026-09-12 21:57:33 +02:00
Tanner Linsley
05422da535
docs(start): correct authentication server function examples (#8368)
* docs(start): correct authentication server function examples

* docs(start): prevent caching session-specific auth pages

* docs(start): guard login forms until hydration

* test(start): assert authentication behavior in SSR and SPA modes
2026-09-11 17:22:55 -06:00
Tanner Linsley
3487cf0451
docs(start): redirect obsolete Solid tutorial path (#8379) 2026-09-11 17:14:55 -06:00
Tanner Linsley
0b152a7b5e
docs(start): add production release checklist (#8373)
* docs(start): add production release checklist

* docs(start): clarify authenticated CSRF and cache checks
2026-09-11 17:14:04 -06:00
Tanner Linsley
e047e3f7ca
docs(start): add tested TanStack Query integration guide (#8372)
* docs(start): add tested TanStack Query integration guide

* fix(examples): protect Query server functions from cross-site calls
2026-09-11 17:13:58 -06:00
Tanner Linsley
c6c282b786
docs(start): distinguish authentication page titles (#8378) 2026-09-11 17:12:52 -06:00
Tanner Linsley
dbf0bd9582
docs(start): add a tested Next.js migration reference (#8371)
* docs(start): add a tested Next.js migration reference

* fix(examples): serialize migration save and sign-out actions

* fix(examples): verify authenticated cross-site mutation rejection
2026-09-11 17:12:47 -06:00
Tanner Linsley
83b2199b4c
docs(start): substantiate framework comparison claims (#8369) 2026-09-11 15:06:24 -06:00
Tanner Linsley
d48ae42b85
docs(start): describe key search entry pages (#8367) 2026-09-11 14:47:42 -06:00
Tanner Linsley
931fae487e
docs(start): fix tutorial and ISR guide links (#8366)
* docs(start): fix broken createServerFn doc links in reading-writing-file tutorials

The 'server-functions' page moved from /framework/{react,solid}/server-functions
to /framework/{react,solid}/guide/server-functions in a recent docs refactor.
The old URL returns 307 redirects that hang (tanstack.com server is
timing out on these paths) — effectively a 404 from the user perspective.

Verified manually: the new /guide/server-functions path returns 200 for
both react and solid variants. The link text in the tutorial points to
'createServerFn', which is documented on the new page.

* docs(start): fix ISR data loading link

---------

Co-authored-by: sanjibani <18418553+sanjibani@users.noreply.github.com>
2026-09-11 14:36:09 -06:00
EduardF1
d91b383b8f
docs(start): fix broken routing-side guide link in authentication primitives (#7701) (#7705)
docs(start): fix broken routing-side guide link in authentication primitives

The "routing-side guide" links in the Authentication Server Primitives guide
used a relative path (`../../../../router/guide/authenticated-routes.md`).
While that resolves as a file path, it renders to an invalid site URL
(`/start/latest/router/guide/authenticated-routes`) and 404s.

Use the absolute cross-project doc path that the rest of the docs already use
for Router links, e.g. `/router/latest/docs/framework/react/guide/authenticated-routes`.

Closes #7701

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-11 14:34:50 -06:00
Sarah Gerrard
f021f6d1c6
perf(history): avoid temporary arrays in memory history (#8352) 2026-09-11 07:51:30 -07:00
Flo
9872d2ac39
perf(history): use lightweight history for server rendering (#8354) 2026-09-11 11:45:21 +02:00
github-actions[bot]
6494e75362
ci: Version Packages (#8330) release-2026-09-10-1817 @tanstack/react-router@1.170.35 @tanstack/react-start-client@1.168.33 @tanstack/react-start-rsc@0.1.51 @tanstack/react-start-server@1.167.40 @tanstack/react-start@1.168.52 @tanstack/solid-router@1.170.33 @tanstack/solid-start-client@1.168.32 @tanstack/solid-start-server@1.167.39 @tanstack/solid-start@1.168.50 @tanstack/start-plugin-core@1.171.42 @tanstack/start-server-core@1.169.34 @tanstack/vue-router@1.170.32 @tanstack/vue-start-client@1.167.35 @tanstack/vue-start-server@1.167.39 @tanstack/vue-start@1.168.49
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-10 20:11:56 +02:00
Corbin Crutchley
8c43c71252
fix: upgrade TanStack Store to latest (#7824)
* fix: upgrade TanStack Store to 0.11.x

* fix: add isServer edgecase to Vue Router

* Revert "fix: add isServer edgecase to Vue Router"

This reverts commit 18b52ab215.

* chore: remove useSelector in favor of upstream

* fix: handle CatchNotFound memory leaks

* fix(vue): migrate to use defineComponent properly

* fix: accept SFCs for routes
2026-09-10 19:41:24 +02:00
Flo
0ba4e9f03b
fix(nx): cache benchmark checks and build measurements (#8343)
* chore: update nx to 23.2.0

* fix(nx): remove deprecated self dependencies from Playwright plugin

* fix(nx): cache benchmark checks and build measurements
2026-09-10 18:55:36 +02:00
Flo
0a89977174
fix(nx): remove deprecated self dependencies from Playwright plugin (#8342)
* chore: update nx to 23.2.0

* fix(nx): remove deprecated self dependencies from Playwright plugin
2026-09-10 18:55:17 +02:00
Flo
1eb8b03595
chore: update nx to 23.2.0 (#8341) 2026-09-10 18:28:24 +02:00
Flo
d914b085bb
fix(start-server-core): correctly iterate response headers (#8340)
* test(start-server-core): cover response header replacement

Carry forward the five tests from #5537 and extend cookie and header-name coverage.

Co-authored-by: Carlos González <carlos.rgn@gmail.com>

* fix(start-server-core): correctly iterate response headers

* fix(start-server-core): preserve live response headers

---------

Co-authored-by: Carlos González <carlos.rgn@gmail.com>
2026-09-10 17:27:44 +02:00
Flo
130992b32f
test(start): cover transformed script URL escaping in SSR (#8336) 2026-09-10 15:46:59 +02:00
Kevin Van Cott
3b27db6c38
docs: remove duplicate Router and Start page headings (#8339) 2026-09-10 12:32:59 +02:00
Flo
69c07c4bbf
test(router-core): cover search-derived context boundaries (#8334)
* test(react-router): cover search-derived context boundaries

* test(router-core): move search context boundary coverage to core
2026-09-10 11:05:54 +02:00
Flo
b1c9219439
perf(solid-router): skip client setup for all server links (#8316)
* perf(solid-router): skip client setup for all server links

* test(solid-router): preserve caller props for internal SSR links

* Merge branch 'main' into codex/solid-link-server-all [Self-Healing CI Rerun]

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-09-10 07:55:02 +02:00
Sarah Gerrard
76239a34b7
fix(solid): avoid repeated hydration scans and script execution (#8270)
* fix(solid): avoid repeated hydration scans and script execution

* test: assert hydration boundary behavior

* test(solid): cover script counts and local hydration lookups
2026-09-09 19:02:21 -07:00
github-actions[bot]
edeb19979e
ci: Version Packages (#8281) release-2026-09-09-2148 @tanstack/history@1.162.3 @tanstack/nitro-v2-vite-plugin@1.155.2 @tanstack/react-router@1.170.34 @tanstack/react-start-client@1.168.32 @tanstack/react-start-rsc@0.1.50 @tanstack/react-start-server@1.167.39 @tanstack/react-start@1.168.51 @tanstack/router-cli@1.167.35 @tanstack/router-core@1.171.29 @tanstack/router-generator@1.167.35 @tanstack/router-plugin@1.168.37 @tanstack/router-utils@1.162.3 @tanstack/router-vite-plugin@1.167.37 @tanstack/solid-router@1.170.32 @tanstack/solid-start-client@1.168.31 @tanstack/solid-start-server@1.167.38 @tanstack/solid-start@1.168.49 @tanstack/start-client-core@1.170.29 @tanstack/start-plugin-core@1.171.41 @tanstack/start-server-core@1.169.33 @tanstack/start-static-server-functions@1.167.34 @tanstack/start-storage-context@1.167.31 @tanstack/vue-router@1.170.31 @tanstack/vue-start-client@1.167.34 @tanstack/vue-start-server@1.167.38 @tanstack/vue-start@1.168.48
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-09 23:43:22 +02:00
Flo
9c1871ccc8
fix: harden URL handling across Router and Start (#8308)
* fix: harden URL handling across Router and Start

* fix: preserve unload blockers after document navigation

* perf: reduce document navigation guard size
2026-09-09 23:03:49 +02:00
Manuel Schiller
f9836f16f0
perf(router-core): avoid empty query serializer allocations (#8313)
Construct URLSearchParams only when the first non-undefined input is serialized. Preserve inherited enumeration, getter/callback order, falsy values, empty custom output and native set collision semantics. Add failing-before empty-allocation cases and focused empty-query benchmark cases.

Against d40fb30307, four balanced isolated-process pairs reduced client shared-param CPU 7.89% (95% CI -12.61% to -2.92%) and wall 7.36% (-12.77% to -1.61%). SSR shared-param CPU fell 15.65% (-18.07% to -13.15%) and wall 15.63% (-18.72% to -12.41%). Populated middleware search remained inconclusive: CPU -0.20% (-2.69% to +2.36%), wall +0.02% (-3.36% to +3.51%).

React Router minimal/full gzip +1/+7 bytes; deltas across all 18 fixtures range -3 to +7 bytes. Custom stringifySearch and middleware are still executed; no API or functionality removed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 22:51:44 +02:00
Manuel Schiller
9aec5a7012
perf(react-router): avoid redundant Link state prop allocations (#8311)
Links resolve one state-prop bag instead of separate active and inactive bags. Class names do not need temporary arrays. Unchanged styles retain their original references. Callback behavior and prop precedence remain unchanged.

React Link rendering benchmark, measured separately for this commit
and its parent using exact production builds:
- Workload: benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  (200 persistent Links, eight navigations per measured batch).
- Apple M4, Node 24.20.0, Vitest 4.1.4, NODE_ENV=production.
- 8 fresh parent processes and 8 fresh processes for this commit,
  each with warmupIterations=50 and time=10000 ms;
  counterbalanced run order.
- Parent mean times (ms): 3.9412, 3.8998, 3.8950, 4.2674, 4.0423, 3.8793, 3.9043, 4.1120.
- This commit mean times (ms): 3.8767, 3.8900, 4.5507, 4.0116, 3.8297, 3.8582, 3.8879, 4.0157.
- Median run means: 3.9228 -> 3.8889 ms.
- Incremental effect: 0.86% less time; throughput change +0.87%.
- Largest within-run RME for this revision: 3.08%.
- The small difference is not a reliable speedup claim; it is close to
  process-to-process variation.

Incremental minimal/full React gzip impact: -12/-7 bytes.
Benchmark sources and commit implementation trees are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 22:22:12 +02:00
Flo
539e5985cf
test(router-core): cover SSR URL encoding regressions (#8307) 2026-09-09 16:26:19 +02:00
Sarah Gerrard
49bcd4db74
chore: refresh Router and Start dependencies (#8300)
* chore: refresh Router and Start dependencies

* chore: centralize shared dependencies

* chore: keep examples self-contained

* chore: sync catalog versions into examples

* test(start-plugin-core): refresh hydration snapshots and portable fixtures
2026-09-09 06:27:59 +02:00
Sarah Gerrard
9871c06258
perf(router-core): index cache membership checks per commit (#8288) 2026-09-07 16:59:23 -07:00
Flo
0654c0a1a4
fix(router-core): reload documents for cross-origin rewrites (#8287)
* fix(router-core): reload documents for cross-origin rewrites

* test(router): expand document navigation coverage

* fix(router): respect registered document navigation blockers
2026-09-08 01:23:05 +02:00
Sarah Gerrard
919c397149
perf(start-plugin-core): skip unused manifest build data (#8261)
* perf(start-plugin-core): skip unused manifest build data

* fix(start-plugin-core): skip Rsbuild CSS capture during development

* update tests per review
2026-09-08 00:21:49 +02:00
Flo
0f40695fbe
test: cover existing navigation and redirect behavior (#8286) 2026-09-07 21:35:15 +02:00
Flo
aee42c6b64
perf(react-router): avoid unnecessary composed handlers (#8279)
* perf(react-router): avoid unnecessary composed handlers

* perf(react-router): shorten composed handler fast path

* test(react-router): remove handler benchmark
2026-09-07 13:25:36 +02:00
github-actions[bot]
a58e01c604
ci: Version Packages (#8182) release-2026-09-06-2127 @tanstack/history@1.162.2 @tanstack/nitro-v2-vite-plugin@1.155.1 @tanstack/react-router@1.170.33 @tanstack/react-start-client@1.168.31 @tanstack/react-start-rsc@0.1.49 @tanstack/react-start-server@1.167.38 @tanstack/react-start@1.168.50 @tanstack/router-cli@1.167.34 @tanstack/router-core@1.171.28 @tanstack/router-generator@1.167.34 @tanstack/router-plugin@1.168.36 @tanstack/router-vite-plugin@1.167.36 @tanstack/solid-router@1.170.31 @tanstack/solid-start-client@1.168.30 @tanstack/solid-start-server@1.167.37 @tanstack/solid-start@1.168.48 @tanstack/start-client-core@1.170.28 @tanstack/start-plugin-core@1.171.40 @tanstack/start-server-core@1.169.32 @tanstack/start-static-server-functions@1.167.33 @tanstack/start-storage-context@1.167.30 @tanstack/vue-router@1.170.30 @tanstack/vue-start-client@1.167.33 @tanstack/vue-start-server@1.167.37 @tanstack/vue-start@1.168.47
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-06 23:22:45 +02:00
Flo
216c0c4803
perf(router-core): reduce navigation promise chains (#8259)
* test(router-core): cover navigation promise overhead

* test(router-core): cover blocking readiness and queued SSR cancellation

* perf(router-core): reduce navigation promise chains

* test(router-core): focus awaitable coverage on standard promises

* perf(router-core): bypass cancellable waits for synchronous beforeLoad

* chore: remove navigation investigation artifacts

* refactor(router-core): return chunk failures directly
2026-09-06 18:55:52 +02:00
Flo
9035abc411
fix(history): handle blockers consistently across history traversal (#8264)
* fix(history): preserve unload blockers during back and forward navigation

* fix(history): respect ignoreBlocker in go navigation

* fix(history): reverse blocked traversal by its delta
2026-09-06 16:19:47 +02:00
Flo
e16faec455
test: reduce memory benchmark variance and simplify the harness (#8260)
* ci: allow memory-only benchmark experiments

* test: apply Node compiler and GC corrections to memory workers

* test: replace adaptive memory GC polling with fixed work

* test: control the memory worker old-generation GC budget

* test: measure natural churn and single-request memory footprints

* test: isolate memory error-path workers

* test: remove code generation from memory measurements

* test: make aborted memory requests follow cancellation

* test: simplify memory cancellation helpers

* test: remove incremental marking from memory measurements

* test: track shared memory runtime in type-check cache

* test: separate memory warmups with an event-loop turn

* test: reset client memory apps between benchmark invocations

* chore: remove stale memory benchmark guidance

* test: control the memory benchmark coordinator runtime

* revert: keep the better-tested memory benchmark runtime

* test: restore JIT in memory benchmark workers

* docs: record memory worker flag removal evidence

* test: remove added memory unit tests and restore workflow
2026-09-06 13:11:27 +02:00