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

6,478 commits

Author SHA1 Message Date
Tanner Linsley
5fcf33e871 release: v1.161.4 v1.161.4 2026-02-21 11:18:59 +00:00
Abhisar Mehta
608007acdf
fix(router): catch stringifyParams errors and render errorComponent (#6718) 2026-02-21 12:06:18 +01:00
Ulrich Stark
ad0beaf95b
chore: remove unnecessary type assertions (#6365)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-21 11:29:18 +01:00
Ulrich Stark
31ae74fc72
docs: fix syntax error in create-route-property-order.md (#6711)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-21 03:47:05 +01:00
Birk Skyum
63f804a439
build(router-devtools-core): forward compat to vite 8 (#6717) 2026-02-20 21:14:32 +01:00
Sean Cassiere
8bdf8d6df7
docs: move the react-only guides to top-level and restrict in config.json (#6713)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-02-20 22:45:33 +13:00
Birk Skyum
4def459cb6
testing(vite-ecosystem-ci): add vite as direct dev depencency (#6709) 2026-02-20 01:58:27 +01:00
Manuel Schiller
4ec6f50d3b
chore: stabilize tests (#6492) 2026-02-20 01:11:21 +01:00
JongKyung Lee
33f253eaff
docs: clarify that location hash excludes the leading # (#6707) 2026-02-20 01:05:54 +01:00
Tanner Linsley
5a8fc3e682 release: v1.161.3 v1.161.3 2026-02-20 00:01:06 +00:00
Manuel Schiller
f453943df5
fix: avoid false positives in import-protection plugin (#6708) 2026-02-20 00:50:05 +01:00
Ulrich Stark
c87d84893b
docs: fix syntax error in create-route-property-order.md (#6699)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-19 23:56:55 +01:00
Ulrich Stark
149e760255
docs: add NotFoundError to lint exceptions and fix wording (#6701) 2026-02-19 23:55:46 +01:00
Flo
c3ad063785
chore: migrate to @tanstack/store 0.9.1 (#6691) 2026-02-19 22:26:59 +01:00
Birk Skyum
965d95f3b8
chore: bump srvx 0.11.2 -> 0.11.7 (#6705)
srvx 0.11.7
2026-02-19 21:41:56 +01:00
Tanner Linsley
988577a8ae release: v1.161.2 v1.161.2 2026-02-19 07:41:42 +00:00
Flo
6d465bcceb
fix(eslint-plugin-router): support ESLint v10 (#6696) 2026-02-19 08:39:31 +01:00
Birk Skyum
923fe9c5af
chore: disable Nx cloud cache for vite ecosystem ci (#6695)
skip cloud cache for vite ecosystem ci
2026-02-18 16:59:52 +01:00
Tanner Linsley
6dfef62add release: v1.161.1 v1.161.1 2026-02-18 08:58:14 +00:00
Flo
99e3025650
fix(react-router): keep relative link active when changing inherited param (#6689) 2026-02-18 09:56:01 +01:00
Tanner Linsley
d5e5fbea6b release: v1.161.0 v1.161.0 2026-02-18 00:19:12 +00:00
Manuel Schiller
711f3b858e
feat: import protection (#6688) 2026-02-18 01:16:30 +01:00
Flo
0f4584b6bf
chore: migrate Nx to 22.5.1 (#6682)
chore(nx): upgrade to 22.5.1
2026-02-17 22:58:15 +01:00
Pavan Shinde
c96fe3dc9f
docs: fix useCanGoBack link path (#6684) 2026-02-18 02:07:47 +13:00
Tanner Linsley
08a2d090be release: v1.160.2 v1.160.2 2026-02-16 19:28:33 +00:00
Manuel Schiller
5d667aa436 fix test 2026-02-16 20:17:27 +01:00
Manuel Schiller
27a563ea1d
fix: script hydration (#6681) 2026-02-16 19:22:09 +01:00
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