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

6,701 commits

Author SHA1 Message Date
Tanner Linsley
c7bf332590 release: v1.160.1 v1.160.1 2026-02-16 18:12:43 +00:00
Manuel Schiller
227dfaf21b
fix: prevent var name clash in generated route for escaped strings (#6680) 2026-02-16 19:10:54 +01:00
Stefan Ollinger
cf5a26984d
docs: Fixed filenames (#6675)
Fixed filenames
2026-02-15 22:27:26 +01:00
Flo
bab64df13b
chore(agents): encourage using nx and pnpm instead of direct execution, add instruction for sandboxed execution (#6671) 2026-02-15 17:28:37 +01:00
SeanCassiere
027dc05817
docs(eslint): update installation to use unified tabbed markup 2026-02-16 00:11:24 +13:00
Sean Cassiere
e8c5dd0b11
docs(router): restructure docs to use the unified markdown syntax (#6665)
* docs: move overview page

* docs: move all top-level guides to use generic syntax

* make comparison generic

* apply coderabbit suggestions

* docs: move installation guides

* docs: move integrations

* docs: move routing

* docs: move router reference api

* docs: move guides

* docs: fixup links to guides from api reference

* docs: other fixups

* build(llms): LLM generation to account for doc structure change
2026-02-15 21:00:22 +13:00
Tanner Linsley
02d88bf876 release: v1.160.0 v1.160.0 2026-02-15 07:06:53 +00:00
Flo
6ddb5867cc
feat(router-core, react-router, solid-router, vue-router): isDangerousProtocol uses customizable allowlist (#6542) 2026-02-15 08:04:28 +01:00
Tanner Linsley
c5d328adfd release: v1.159.14 v1.159.14 2026-02-15 01:46:10 +00:00
홍규진
067951fcf0
fix(react-router): remove async/defer attributes during hydration to prevent warnings (#6479)
* fix(react-router): prevent hydration warning for async/defer scripts

Strip async, defer, and src attributes from script tags during client-side hydration to match the server-rendered output and prevent React hydration mismatch warnings.

* test(react-router): add unit and e2e tests for async script hydration

Adds unit tests to verify server output includes async/defer attributes, and e2e tests to verify no hydration warnings occur on the client.

---------

Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
2026-02-15 02:31:46 +01:00
Manuel Schiller
27d0867ff8
add internal docs for code splitting (#6661)
* add internal docs for code splitting

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-14 21:44:43 +01:00
Kyle Mathews
988a9d6788
test: add invariant and property tests for code-splitter shared bindings (#6662)
* test: add invariant, property, and exhaustive tests for code-splitter shared bindings

Add 76 new tests across three layers for the shared virtual module
code-splitting logic introduced in #6659:

Layer 1 - Algebraic property tests on helper functions:
- expandTransitively: idempotence, monotonicity, cycle handling
- buildDependencyGraph: subset invariants
- removeBindingsDependingOnRoute: direct/transitive removal
- expandDestructuredDeclarations: idempotence, sibling expansion
- collectLocalBindingsFromStatement: all declaration types

Layer 2 - Invariant tests on computeSharedBindings:
- Route is never in the shared set
- Results are always real local bindings (never imports)
- Destructured siblings cohesion
- Transitive dependency inclusion
- Route-dependent binding exclusion
- Determinism across repeated calls

Layer 3 - Small-scope exhaustive tests:
- Single binding × 3 declaration kinds × 4 property patterns × 2 groupings
- Two bindings × 4 cross-group reference patterns × 2 groupings
- Transitive dependency chains (linear, 3-deep, diamond)
- Meta-invariant conformance across all shared-* fixture files

Testing approach inspired by:
https://gist.github.com/KyleAMathews/64bcea53a57f600cc3b73bc366d9ac4d

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

* ci: apply automated fixes

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-14 18:41:23 +01:00
Pavan Shinde
6ee158639e
docs(start): fix typos in React quick start (#6638) 2026-02-14 11:15:41 -06:00
Tanner Linsley
8360649b99 release: v1.159.13 v1.159.13 2026-02-14 15:58:55 +00:00
Yuki Kakazu kekezun kkzn
426c2b54fe
fix: pass pathname to global request middleware in createStartHandler (#6648)
* fix: pass pathname to global request middleware in createStartHandler

The two `executeMiddleware` calls for global request middleware in
`createStartHandler` were missing the `pathname` property, causing it
to be `undefined` at runtime despite `RequestServerOptions` declaring
it as `pathname: string`.

- Add `pathname: url.pathname` to server function middleware execution
- Add `pathname: url.pathname` to page request middleware execution

The route-level middleware in `handleServerRoutes` already passes
`pathname` correctly.

Closes TanStack/router#6647

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

* test: add regression test for pathname in global request middleware (#6647)

Add e2e tests to server-functions-global-middleware verifying that
pathname is correctly passed to global request middleware in
createStartHandler.

- Add pathnameMiddleware that captures pathname from server callback
- Add dedicated pathname-middleware route and test page
- Verify pathname value on both SSR and client-side navigation

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

* refactor: remove unnecessary `as any` cast from pathname middleware test

The middleware type system correctly infers `requestMiddlewarePathname`
on the context, so the explicit cast is not needed.

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

* ci: apply automated fixes

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-14 16:45:18 +01:00
Tanner Linsley
ffec9c987d release: v1.159.12 v1.159.12 2026-02-14 12:12:57 +00:00
Manuel Schiller
523972e0df
fix: shared virtual module for code-split routes (#6659)
* fix: shared virtual module for code-split routes

When a route file has module-level bindings (variables, functions, classes) referenced by **both** split and non-split route properties, the bindings are duplicated — initialized independently in the reference file and in each virtual split file. This breaks singletons, causes double side effects, and wastes bundle size.

```tsx
const collection = { name: 'todos', preload: async () => {} }
export const Route = createFileRoute('/todos')({
  loader: async () => {
    await collection.preload()
  }, // stays in reference
  component: () => <div>{collection.name}</div>, // split to virtual
})
```
In this example, `collection` is initialized in **both** the reference file (because `loader` references it) and the `?tsr-split=component` virtual file (because the component references it). Two separate instances exist at runtime.

To solve this issue, this PR introduces a third virtual module `route.tsx?tsr-shared=1` that contains shared bindings. Both the reference and virtual files import from it.

When `sharedBindings` is empty (the common case — component-only helpers, loader-only code), no shared module exists and the system works exactly as today.

The reference transform runs first and will emit a static import of `?tsr-shared=1` **only when needed**. Since split chunks are only discovered via the reference file's emitted `import('...?tsr-split=...')`, the bundler will always process/evaluate the reference module first. Result: the shared module is evaluated once and then reused by any later-loaded split chunk.
2026-02-14 13:10:54 +01:00
Tanner Linsley
1afa90e8c6 release: v1.159.11 v1.159.11 2026-02-14 01:40:20 +00:00
Manuel Schiller
30dc11e50a
fix: autoCodeSplitting` with destructured export (#6656)
fixes #4787
2026-02-14 02:26:03 +01:00
Tanner Linsley
f3e3bd44e9 release: v1.159.10 v1.159.10 2026-02-14 01:20:49 +00:00
nikuscs
fb139e8c70
fix: preserve data script content during client hydration (#6653)
* fix: preserve data script content during client hydration

The Script component renders all <script> tags with empty content on
the client side, then uses useEffect to recreate them via DOM
manipulation. While necessary for executable scripts (they need
document.createElement to trigger execution), this causes data-only
scripts like application/ld+json to briefly flash empty during
hydration.

Per the HTML spec, any script with a type that isn't a JavaScript MIME
type or "module" is a "data block" that the browser never executes.
These can safely render their content directly via innerHTML on both
server and client, just like <style> tags already do in the same file.

Changes across react-router, solid-router, and vue-router:
- Detect non-executable script types via the type attribute
- Early-return in the client-side effect for data scripts
- Render data script content directly instead of emptying it

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-14 02:08:07 +01:00
Manuel Schiller
f212098655
fix: lazy-compile server fn on dev restart to avoid invalid ID error (#6655)
fixes #6609
2026-02-14 01:59:24 +01:00
Tanner Linsley
1dde02476a release: v1.159.9 v1.159.9 2026-02-14 00:47:20 +00:00
Manuel Schiller
2148b1bb4d
fix: resolve pending state when throwing notFound in beforeLoad (#6654)
fixes #6021
2026-02-14 01:44:53 +01:00
Tanner Linsley
ed8c679b92 release: v1.159.8 v1.159.8 2026-02-13 23:21:57 +00:00
JongKyung Lee
d03f6d720e
fix: prevent prerender hang when filter returns zero results (#6619)
* fix(prerender): add check for settled queue to skip empty prerender filter

* test(prerender): add test for resolving when prerender filter matches no pages
2026-02-14 00:10:16 +01:00
Tanner Linsley
5529857b22 release: v1.159.7 v1.159.7 2026-02-13 20:11:00 +00:00
Manuel Schiller
d931bcff15
fix: don't propagate directCall kind through var bindings (#6651) 2026-02-13 21:03:51 +01:00
Tanner Linsley
70effc8db4 release: v1.159.6 v1.159.6 2026-02-13 18:36:21 +00:00
Manuel Schiller
85b34a799f
fix: don't cache server side route tree during dev (#6650)
fixes #6556
fixes #6559
fixes #6640
2026-02-13 19:34:06 +01:00
Yuki Terashima
a8c786cbe0
docs(start): Update TanStack Builder link in getting started guide (#6641)
Update TanStack Builder link in getting started guide
2026-02-13 19:22:50 +01:00
Birk Skyum
97658cde9a
test: vite ecosystem ci entry points (#6644) 2026-02-13 06:14:23 +01:00
Birk Skyum
174be108f2
chore: optimize links to github (#6633) 2026-02-10 23:42:52 +01:00
Tanner Linsley
4e1f40f2bc release: v1.159.5 v1.159.5 2026-02-09 13:09:13 +00:00
Birk Skyum
641720f969
perf: revert to Response, and add docs regarding for FastResponse (#6618) 2026-02-09 14:06:44 +01:00
Tanner Linsley
260f97baea release: v1.159.4 v1.159.4 2026-02-09 00:56:42 +00:00
Lee Jong Kyung
5c923e45c3
fix(router): ensure useParams returns parsed params when strict is false (#6387)
* fix: optimize match retrieval by using a Map for previous matches

* feat: add strict false parameter handling and related routes

* replace params only when routeParams is fully parsed

---------

Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
Co-authored-by: Nico Lynzaad <44094871+nlynzaad@users.noreply.github.com>
2026-02-09 02:44:30 +02:00
Tanner Linsley
be8849eee2 release: v1.159.3 v1.159.3 2026-02-08 20:08:49 +00:00
Birk Skyum
7927dcd329
perf(start): use FastResponse from srvx (#6616) 2026-02-08 21:06:21 +01:00
Tanner Linsley
34aecb819b release: v1.159.2 v1.159.2 2026-02-08 14:20:33 +00:00
huseeiin
a90d46418b
perf(solid-start): use srvx FastResponse (#6615)
* perf(solid-start): 51% improvement

* patch response

* install srvx

* import order

---------

Co-authored-by: Birk Skyum <birk.skyum@pm.me>
2026-02-08 15:09:08 +01:00
Birk Skyum
88161bd480
chore: update srvx to 0.11.2 and h3-v2 to rc.14 (#6608) 2026-02-07 03:28:50 +01:00
Tanner Linsley
1ca7b6df1b release: v1.159.1 v1.159.1 2026-02-07 02:18:08 +00:00
Nico Lynzaad
972d347b8e
fix(solid-start): make Link active class reactive for include hash (#6607)
solid-start: make Link active class reactive for include hash
2026-02-07 04:06:41 +02:00
Tanner Linsley
7bf556a40c release: v1.159.0 v1.159.0 2026-02-07 01:03:55 +00:00
Manuel Schiller
06f3aeca0f
feat: add transformAssetUrls (#6606)
* feat: add transformAssetUrls

* fix docs

* stringify safely

* fix test

* fix
2026-02-07 02:01:46 +01:00
Tanner Linsley
ee8fde15b0 release: v1.158.4 v1.158.4 2026-02-07 00:02:41 +00:00
Nico Lynzaad
40ed6832c6
fix(start-server-core): redirect misinterpreted protocol-relative URLs (#6600)
* add test to verify redirect

* handle redirect

* update tests

* cleanup unused code in decodePath

* use 308 instead of 302

* redirect is not relevant in spa mode
2026-02-07 02:00:19 +02:00
Alexander Zuev
172fa05573
docs: add Cloudflare Workers handlers section to server entry point (#6488)
* docs: add Cloudflare Workers handlers section to server entry point

* docs: append link to official Cloudflare Workers docs

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

* docs: reduce to link per reviewer feedback

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 23:15:11 +01:00
Tanner Linsley
bb0137d280 release: v1.158.3 v1.158.3 2026-02-05 21:50:29 +00:00