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

1,354 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
Manuel Schiller
cbbfbe37ab
optimize streaming (#8204) 2026-09-16 22:38:25 +02:00
Manuel Schiller
856cfcd05a
agents (#8258)
* agents

* update

* docs: require upstream fixes for dependency issues
2026-09-15 22:36:13 +02:00
Manuel Schiller
634da9176e
perf(router-core): streamline route initialization (#8327)
* perf(router-core): reuse parsed route segments for interpolation

Capture original template segments during the existing route-tree parse.
Interpolation only substitutes current values and produces fresh metadata;
it never reparses known routes, including first use and trailing-slash
variants. Rebuild the captured data with the tree for HMR. Parse unknown
templates once per bounded entry and reuse their segments across decoder
changes. Update Devtools and internal test consumers.

Remove internal undefined-path/server-flag compatibility and the divergent
SSR scanner. Both runtimes follow the canonical splat grammar. Keep the
128-result route cache after measuring its removal rather than adding an
unproven configuration option.

Measured against 41e42009be with frozen production bundles:
- 26 client/SSR Link cases, 4 paired replicas each: client unique params
  -3.94% CPU [95% CI -6.30,-1.52], optionals -2.58% [-4.34,-0.78].
  Other cases inconclusive; no supported end-to-end slowdown.
- 1000-route client high-cardinality interpolation -18.55..-24.83%;
  matching with fresh metadata -14.69..-19.12% (5 process samples).
- 1000-route client setup costs an extra 0.084..0.192 ms; sparse first use
  costs about 0.23..0.28 us/call. Retained segment data adds about 200..298 B
  per dynamic route in the measured fixtures.
- All 18 bundle cases add 303..392 gzip B; React minimal/full +311/+326 B.
- Cache-off saves 0.8..0.9 MiB per 1000 used routes and 1.2..1.5 MiB after
  growth, but client encoding/splat Links regress 25.31%/12.71% and SSR
  encoding/splats regress 21.76%/25.37%; retain result caching.
- Shared-value sampled allocations rise 2.18% client/5.23% SSR without that
  cache. Native Vue peaks remain effectively unchanged (macOS captures,
  not a new Linux CodSpeed CI run). Benchmark counts/JIT/GC flags unchanged.

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

* perf(router-core): avoid temporary route initialization joins

Build route IDs and full paths with direct string assembly and the existing
cleanPath normalizer. Avoid temporary filter/join arrays and the second ID
normalization. Pathless layouts keep the parent's fullPath unchanged.

Add a focused construction benchmark with fresh route objects and separate
processing-only / allocation-plus-processing cases at 100/1000/10000 routes.
Document why client-nav route-tree-scale is not a construction benchmark.

Standalone attribution against 41e42009be, otherwise unchanged Uint16Array
parser, 7 fresh process replicas and 1000 routes per tree:
- Client processRouteTree+route.init CPU improves 11.48-19.57% across
  static, dynamic, nested and mixed trees (all 95% intervals below zero).
- Server CPU improves 9.39-22.29% (all 95% intervals below zero).
- React Router minimal gzip +6 bytes; the composed parse-once implementation
  is measured separately against the required original bundle budget.

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

* perf(router-core): reuse stable path parameter decoders

Compare allowed-character values rather than recompiling the decoder on
every provider-style options update. Equivalent arrays retain warm route
paths; in-place edits and option removal update encoding correctly.
Publish the configuration key only after successful compilation, and
declare optional state without forcing an unused instance field.

Isolated against 3e0b23f46c with the same path-decoder.bench.ts, seven
alternating independent process pairs (200 locations per batch):
- Stable provider updates: 143.3707 -> 122.5572 us, -14.52%
  (95% process interval -15.51% to -13.52%).
- No-update control: 119.1170 -> 118.8155 us, -0.25%
  (interval -1.05% to +0.55%).
- Deliberately changing configuration every batch: 143.8213 -> 147.7340 us,
  +2.72% (interval +1.38% to +4.08%). Reconfiguration remains the cold path.

These are decoder/update mechanism measurements, not a claim about every
React Link render. Standalone React minimal gzip: 86121 -> 86142 bytes
(+21); raw +48 bytes, Brotli +10 bytes.

Add coverage for equivalent options, mutation, removal, direct overrides
and retrying failed compilation.

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

* perf(router-core): simplify route-owned path interpolation

Share one canonical scanner between tree processing and unknown templates.
Retain compact dynamic records and derive original parameter names lazily,
instead of reconstructing them during matching. Keep initialization/indexing
and traversal in processRouteTree, including existing nested-mask behavior.

Make pathParamsAllowedCharacters initialization-only, as requested. Compile
the readonly decoder once, remove decoder keys/stamps/update invalidation,
and keep path results on each route. Preserve the shared bounded unmatched
template cache across SSR requests; lightweight matching stays router-local.
Do not add an encoding-specific cache, router-level route map or bulk clear.

Move Devtools-only navigation availability outside the hot formatter.
Preserve legacy standalone fallback match identity and cache behavior,
including inherited params and route-tree replacement. Retain useful encoding
comments and explicit tuple-slot labels.

Final measurements (Node 24.8.0, built production JS, unchanged workloads):
- Original React client-nav Link loop versus 41e42009be, four balanced
  fresh-process pairs: CPU 2.5015016 -> 2.4370936 ms per 8-navigation batch,
  -2.57% (95% process interval -3.72% to -1.42%). Wall -2.58%.
- Fresh 1000-route client processing/init: static -12.39%, dynamic -5.34%,
  nested -6.54%, mixed -2.59%. Server static -9.12%; remaining intervals
  are reported separately and the mixed-server result is inconclusive.
- All 18 gzip fixtures are below 41e by 47-88 bytes. React minimal:
  85801 -> 85731; full: 89392 -> 89318. Raw JS -533..-697 bytes;
  Brotli varies by fixture rather than uniformly shrinking.
- Full 26-case paired client/SSR Link suite: no supported regressions;
  most small changes are inconclusive, not claimed as universal speedups.
- Warm retained path-cache heap saves about 7.8 KiB per 1000 routes in
  default/custom configurations. Native Vue peaks remain near baseline;
  peak, allocation totals and end outstanding are measured separately.

Existing literal grammar/URL/matching expectations are preserved. The
independent oracle covers 49638 segment cases and 338 matching/mask traces
within the old offset range. Initialization-only encoding deliberately
supersedes the previous live-update contract.

Detailed measurements and rejected experiments remain in uncommitted
session reports and LOG.md.

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

* perf(router-core): initialize routes directly during tree processing

Remove the optional initRoute callback and unconditionally call
route.init({ originalIndex: index }) at the start of the parent-first visit,
before indexing or parsing the route. Require init on this function's input
without imposing it on masks or the shared template-scanning RouteLike type.

Remove the Router and construction-benchmark forwarding wrappers. Adapt
preinitialized matcher fixtures through one test-only helper with a
non-enumerable no-op init; do not normalize their paths/IDs or change their
expected grammar/matching results. Add real-route initialization order,
index and exactly-once coverage.

Performance versus bc71b06207, seven independent process pairs per
shape/mode using the same built-JS entry and fresh route objects:
- Server static 1000-route processing/init: 0.7781686 -> 0.7623686 ms/tree,
  CPU -2.06% (95% interval -3.26% to -0.84%); wall -2.10%.
- Other construction cells are inconclusive, with no supported slowdown.
- All 18 gzip fixtures improve by 10-26 bytes. React minimal:
  85731 -> 85712 bytes (-19). Raw -20 bytes (-59 for Rsbuild);
  Brotli remains fixture-dependent.

Object creation and forced GC are outside processing timers. The common
measurement entry's obsolete third argument is ignored by the new code,
so once-per-tree callback allocation savings are not overstated.

Full measurements and logs remain in the session's
direct-route-init-20260909 artifacts and uncommitted LOG.md.

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

* perf(router-core): pass route initialization indexes directly

Change the internal initializer to route.init(originalIndex). Update the
Route interface, BaseRoute implementation, processRouteTree contract and
both production call sites, including the standalone legacy fallback.
Remove object-literal arguments without adding compatibility wrappers.

Keep route ordering and stored indexes unchanged. Cover primitive arguments,
index zero and the large legacy fallback index explicitly.

Performance versus f2c2d55f99:
- Seven independent fresh-process construction comparisons per shape/mode
  (100, 1000 and 10000 routes; static/dynamic/nested/mixed) show no
  statistically supported timing difference. Do not claim an unproven
  CPU or heap-byte improvement from the removed object literals.
- All 18 gzip fixtures improve by 7-13 bytes. React minimal:
  85712 -> 85702 (-10); full: 89303 -> 89291 (-12).
- Raw JS decreases by 46 bytes in every fixture. Brotli varies.

The same production-JS phase entry and workloads are used on both sides.
Object creation and forced GC are outside processing timers. Detailed
samples, intervals and logs remain in numeric-route-init-20260909 session
artifacts and uncommitted LOG.md.

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

* update route trees

* ci: apply automated fixes

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-09-13 13:55:04 +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
Flo
9872d2ac39
perf(history): use lightweight history for server rendering (#8354) 2026-09-11 11:45:21 +02:00
Kevin Van Cott
3b27db6c38
docs: remove duplicate Router and Start page headings (#8339) 2026-09-10 12:32:59 +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
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
Flo
2f20c00224
fix(router-core): skip lifecycle callbacks below fallback boundaries (#8165)
* fix(router-core): track lifecycle membership through fallback boundaries

* test(router-core): benchmark fallback lifecycle dispatch

* test(router-core): preserve explicitly targeted not-found lifecycle

* perf(router-core): avoid lifecycle prefix allocations

* test(router-core): cover lifecycle dispatch at typical route depths

* perf(router-core): reduce fallback lifecycle bundle overhead

* perf(router-core): omit unused initial lifecycle boundary

* fix(router-core): keep lifecycle metadata declaration compatible with Playwright
2026-09-06 00:00:46 +02:00
Flo
28a5e4504e
fix(router): handle unknown error boundary values (#8209)
* fix(router): handle unknown error boundary values

* fix(router): complete unknown boundary error migration

* docs(router): keep boundary examples within skill limits

* fix(router): restore minimal boundary error display

* fix(solid-router): unify boundary errors across SSR and client
2026-09-05 14:48:44 +02:00
Magnus
650acb4a89
fix(docs): Ensure we use normal install for query integration package (#8228) 2026-09-03 20:01:54 +02:00
Jiahan Chen
aab01dec75
chore(start): remove redundant splitChunks config from React plugin (#8136) 2026-08-22 09:48:38 +02:00
Flo
31355ae92c
fix(react-router): useMatchRoute w/ React Compiler (#8015)
* fix(react-router): useMatchRoute w/ React Compiler

* test(react-router): add React Compiler E2E

Co-authored-by: Kamal Bennani <kamal.bennani@aircall.io>

* disable eslint react-hooks/exhaustive-deps for known static condition w/ DCE

* test(react-router): cover useMatchRoute callback identity

Co-authored-by: Sarah Gerrard <98355961+LadyBluenotes@users.noreply.github.com>

* test(react-router): rely on useMatchRoute subscription

* test(react-router): exercise compiler-generated memoization

* no useCallback during SSR

* update docs

---------

Co-authored-by: Kamal Bennani <kamal.bennani@aircall.io>
Co-authored-by: Sarah Gerrard <98355961+LadyBluenotes@users.noreply.github.com>
2026-08-12 10:35:50 +02:00
Flo
aa10b6589e
fix(router): apply preload delay to viewport links (#8044)
* fix(router): apply preload delay to viewport links

* fix(router): cancel delayed viewport preloads on exit

* fix(router): process queued viewport transitions in order

* fix(router): use latest queued viewport state

* refactor(router): inline viewport observer options

* fix(router): stabilize viewport preload timers

* cleaner timeout map key
2026-08-12 09:52:36 +02:00
Flo
3740f44786
docs: align loader docs with lane rewrite (#7949)
* docs: align loader docs with lane rewrite

* docs: refine lane loader documentation

* docs: expand link preloading guide
2026-08-04 22:23:02 +02:00
Flo
45c4ad8d62
fix(router-core): lane match loader rewrite (#7805)
* fix: lane match loader rewrite

---------

Co-authored-by: Manuel Schiller <6340397+schiller-manuel@users.noreply.github.com>
2026-08-04 20:28:11 +02:00
Ahmed Sabry
10dc3f63e6
docs: version optional param to only capture version not capturing "e… (#7932)
* docs: version optional param to only capture version not capturing "extra" as version

* fix: close template literal
2026-08-04 00:04:26 +02:00
Ahmed Sabry
2cb221cfd3
Fix typo in path-params documentation (#7931) 2026-08-01 14:15:16 +02:00
Sarah Gerrard
a76c192f1c
docs: Update Guides section and add back in missing pages (#7864) 2026-07-22 22:13:55 +02:00
Sajad Torkamani
2b08d9ba4b
docs: minor docs improvements (#7842) 2026-07-22 22:12:34 +02:00
Cong-Cong Pan
21a8597952
chore: add React Start basic Rsbuild example (#7729)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-22 22:09:03 +02:00
Zakher Masri
07ce90304d
docs: remove stray semicolon in i18n page (#7870)
fix: remove stray semicolon
2026-07-21 11:45:50 -07:00
Alex Kostyniuk
31a634d84e
docs: update Next.js middleware description (#6155)
* docs: update Next.js middleware description

* Fix grammar in Next.js Edge Runtime description

Correct grammatical error in comparison of Next.js limitations.

* Revise Next.js proxy.ts runtime details

Updated Next.js proxy.ts description to reflect runtime changes.

* removed the not needed '+'

---------

Co-authored-by: Sarah Gerrard <hello@sarahgerrard.me>
2026-07-17 18:19:11 -07:00
Sajad Torkamani
6184661e56
docs: small improvements to wording (#7840) 2026-07-17 21:40:35 +02:00
Mohamed Yahye El Joud
00d00b3155
docs: Update environment variable validation to use z.url() (#5570) 2026-07-17 20:47:19 +02:00
Florian Fehrenbacher
4d4171fdda
fix: use relative path for srvx static files (#7799) 2026-07-13 23:38:26 +02:00
Flo
ac821f40aa
docs(start): clarify server functions vs server routes (#7651)
* docs(start): clarify server functions and routes usage

* clean up repetition
2026-06-18 12:49:10 +02:00
dfedoryshchev
a2b9d51b0a
docs: fix duplicate "to" typos (#7370) 2026-06-12 22:55:18 +02:00
tsushanth
2215277382
docs(router): drop the broken "LLM Assistance Support" nav entry (#7617) 2026-06-12 21:31:42 +02:00
Tanner Linsley
6f882b7dae
docs(start): rename LLM optimization guide to GEO (#7620) 2026-06-12 11:24:22 -06:00
Nandkishor Jadoun
f111a38249
docs: add 🟡 (Experimental) for TanStack Start RSC support (#7573) 2026-06-07 15:02:31 +02:00
Manuel Schiller
9bebf8dc9f
rename inputValidator to validator (#7566)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-06-06 23:05:56 +02:00
Ulrich Stark
fee0b58c51
refactor: remove unused dependencies (#7541) 2026-06-04 22:47:41 +02:00
Tanner Linsley
ccf87fbe6f
docs: clarify auth data boundaries (#7537) 2026-06-03 12:48:48 -06:00
Manuel Schiller
54b0d9a91e
docs (#7521) 2026-06-01 22:05:37 +02:00
Manuel Schiller
e51ad23c0f
docs (#7520) 2026-06-01 21:46:55 +02:00
Manuel Schiller
51a97a167f
feat(start): support rsbuild iife client output (#7477) 2026-05-24 02:02:05 +02:00
Flo
9f6258f23e
chore: update zod to v4.4.3 (#7441)
* chore: update zod to v4.4.3

* fix(start): preserve route path defaults

* fix(examples): resolve zod 4 build failures
2026-05-20 08:41:45 +02:00
Tanner Linsley
0bfb7efa12
docs(start): compare deferred hydration to React selective hydration (#7442)
Adds a short comparison section answering the common question about how
TanStack Start's deferred hydration relates to React 18's selective
hydration. The framing: selective hydration controls the order of
inevitable hydration work; deferred hydration controls whether and when
that work happens at all.
2026-05-19 19:44:44 -06:00
Tanner Linsley
ac4b43f346
docs(start): compare deferred hydration to Astro islands (#7438)
Adds a short mental-model section answering the common question
about how TanStack Start's deferred hydration relates to Astro
islands.
2026-05-19 15:09:21 -06:00