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

6,694 commits

Author SHA1 Message Date
Ezekiel Keator
3cba9989d2
docs: correct start server git link (#3991) 2025-04-14 19:55:22 +02:00
Tanner Linsley
6e183bae4f release: v1.116.1 v1.116.1 2025-04-13 21:20:12 +00:00
Valentin Kunz
4b7212c564
fix(router-plugin): avoid blocking rspack and webpack during build (#3980) 2025-04-14 09:12:45 +12:00
Seongbin Kim
112438412c
docs(router): broken link to "SSR" from "Deferred Data Loading" guide (#3984) 2025-04-14 09:11:21 +12:00
Yiwan
d4a4e96b62
docs(router): add comment for vite plugin order (#3986)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-04-14 09:10:42 +12:00
Tanner Linsley
d843f83057 release: v1.116.0 v1.116.0 2025-04-13 19:59:11 +00:00
Zac Rosenbauer
f0138f80b0
feat(react-router): Export ClientOnly (#3969)
Exposes the `ClientOnly` component for preventing rendering & hydration
errors.

## Background

When you attempt to prevent content from rendering using something like
`typeof document !== 'undefined'` as that type of conditional will cause
hydration errors.

## API

```tsx
import { ClientOnly, createRoute } from '@tanstack/react-router'
import { Charts, FallbackCharts } from './charts-that-break-server-side-rendering'

const Route = createRoute({
  // ... other route options
  path: '/dashboard',
  component: Dashboard,
})

function Dashboard() {
  return (
    <div>
      <p>Dashboard</p>
      <ClientOnly fallback={<FallbackCharts />}>
        <Charts />
      </ClientOnly>
    </div>
  )
}
```

> [!NOTE]
> This component as is (other than I removed the `children` as a
`function`) in production on [joggr.io](https://joggr.io)

---------

Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
Co-authored-by: Ahmed Abdelbaset <A7med3bdulBaset@gmail.com>
Co-authored-by: Birk Skyum <birk.skyum@pm.me>
2025-04-13 10:50:44 +02:00
Tanner Linsley
af455d812f release: v1.115.3 v1.115.3 2025-04-11 17:19:44 +00:00
Fred Brandt
e3404881ae
fix(router-core): accept AnyRouter in redirect (#3979)
The migration to `router-core` made the `redirect` function
more restrictive since it _only_ used the `RegisteredRouter`.

This change makes it so that it accepts `AnyRouter` with it
defaulting to the `RegisteredRouter`. Also, `TTo` also
needed to be changed, since the first generic became optional.
2025-04-11 21:30:40 +12:00
Sean Cassiere
b886a7d357
chore(examples): move the WorkOS content to src (#3972) 2025-04-10 21:14:55 +12:00
Nick Nisi
f9c343e0b5
chore(examples): add TanStack Start WorkOS example (#3966)
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-04-10 20:41:57 +12:00
Fitim Bytyqi
09e87448b5
docs: devtools installation (#3961)
Edits the way devtools are installed
2025-04-08 13:02:00 +02:00
Tanner Linsley
03a1cb05bb release: v1.115.2 v1.115.2 2025-04-07 20:27:37 +00:00
Denys Isaichenko
9bd706c07e
fix(react-router): fix issue with scroll restoration (#3918)
fixes https://github.com/TanStack/router/issues/3680

It seems like `resolvedLocation` does not always point to the latest
location state in the ref callback; sometimes it points to the previous
location and `onRendered` is not triggered.

Also this fix detaches `onRendered` event from the scroll restoration
feature.
2025-04-07 22:18:25 +02:00
Birk Skyum
7bc761ba8a
chore(examples): Update solid query examples (#3956) 2025-04-07 13:31:42 +02:00
Tanner Linsley
f087b1a7de release: v1.115.1 v1.115.1 2025-04-06 09:21:36 +00:00
Sean Cassiere
6b99e3f85a
refactor(start-client-core): hash the static filenames (#3947)
This change hashes the generated filnames for the JSON blobs that used
for static server function RPC calls.

So it goes from being
```
/__tsr/staticServerFnCache/app_routes_nav_posts_stub_tsx--loadPostServerFn_createServerFn_handler__-this-is-a-post-slug-.json
```

to

```
/__tsr/staticServerFnCache/00e9f7af882c994097f011e6492f2a30e8754bb0.json
```

This has an added benefit of ensuring that the `sha1` hash names are
always the same in character length.
2025-04-06 21:10:43 +12:00
Tanner Linsley
361d32b2d5 release: v1.115.0 v1.115.0 2025-04-06 04:50:31 +00:00
SeanCassiere
e213f1224c
feat: RELEASE_ALL
RELEASE_ALL
2025-04-06 16:49:08 +12:00
Sean Cassiere
ad4ec75e77
chore(examples): change types for input arguments for auth examples (#3946) 2025-04-06 16:46:54 +12:00
Ethan Shumate
a41e7cf6e5
chore(examples): do not use GET to send credentials (#3945)
Fixes #3944

---

Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-04-06 16:41:35 +12:00
Marvin ROGER
30c49e1328
fix(router-core): search parsing of + using URLSearchParams (#3894)
Closes #3655

Switch out our `qss` implementation from its manual solution
over to using `URLSearchParams` for handling
encoding/decoding while still retaining the same interface.

---------

Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-04-06 16:23:28 +12:00
Kid
d1e78bb5f6
docs(router): fix broken link to example in authenticated routes guide (#3937) 2025-04-05 13:53:14 +13:00
renovate[bot]
1bb39b96ad
chore(deps): update dependency vite to v6.1.4 [security] (#3939)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [vite](https://vite.dev)
([source](https://redirect.github.com/vitejs/vite/tree/HEAD/packages/vite))
| [`6.1.3` ->
`6.1.4`](https://renovatebot.com/diffs/npm/vite/6.1.3/6.1.4) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/vite/6.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite/6.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite/6.1.3/6.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite/6.1.3/6.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

### GitHub Vulnerability Alerts

####
[CVE-2025-31486](https://redirect.github.com/vitejs/vite/security/advisories/GHSA-xcj6-pq6g-qj4x)

### Summary

The contents of arbitrary files can be returned to the browser.

### Impact

Only apps explicitly exposing the Vite dev server to the network (using
--host or [server.host config
option](https://vitejs.dev/config/server-options.html#server-host)) are
affected..

### Details

#### `.svg`

Requests ending with `.svg` are loaded at this line.

037f801075/packages/vite/src/node/plugins/asset.ts (L285-L290)
By adding `?.svg` with `?.wasm?init` or with `sec-fetch-dest: script`
header, the restriction was able to bypass.

This bypass is only possible if the file is smaller than
[`build.assetsInlineLimit`](https://vite.dev/config/build-options.html#build-assetsinlinelimit)
(default: 4kB) and when using Vite 6.0+.

#### relative paths

The check was applied before the id normalization. This allowed requests
to bypass with relative paths (e.g. `../../`).

### PoC

```bash
npm create vite@latest
cd vite-project/
npm install
npm run dev
```

send request to read `etc/passwd`

```bash
curl 'http://127.0.0.1:5173/etc/passwd?.svg?.wasm?init'
```

```bash
curl 'http://127.0.0.1:5173/@&#8203;fs/x/x/x/vite-project/?/../../../../../etc/passwd?import&?raw'
```

---

### Release Notes

<details>
<summary>vitejs/vite (vite)</summary>

###
[`v6.1.4`](https://redirect.github.com/vitejs/vite/releases/tag/v6.1.4)

[Compare
Source](https://redirect.github.com/vitejs/vite/compare/v6.1.3...v6.1.4)

Please refer to
[CHANGELOG.md](https://redirect.github.com/vitejs/vite/blob/v6.1.4/packages/vite/CHANGELOG.md)
for details.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no
schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/TanStack/router).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMjcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjIyNy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-04 21:59:55 +00:00
Tanner Linsley
359d19a115 Update partners 2025-04-04 13:29:24 -06:00
Sean Cassiere
bdcf4f7f89
test(router-generator): check filenames starting with a number (#3935) 2025-04-04 14:18:14 +13:00
TN
37fc7e82df
docs: Update scroll-restoration.md (#3934)
Fix typo
2025-04-04 01:35:41 +02:00
SeanCassiere
03ac067c32
chore(root): switch from fs.rmdir to fs.rm 2025-04-03 15:54:25 +13:00
Tanner Linsley
dfa641dc9c release: v1.114.34 v1.114.34 2025-04-02 22:52:22 +00:00
Sean Cassiere
084d42f48f
fix(react-router): missing Symbol declaration for HMR in root route (#3923)
Similar to #3821, the React Symbol declaration was missing on the
`RootRoute` class.

fixes #3917
2025-04-03 11:49:00 +13:00
Tanner Linsley
f8015e7629 release: v1.114.33 v1.114.33 2025-04-02 18:43:59 +00:00
Alex
9b95618f5b
fix(react-router): restore scroll position onResolved (#3914)
Fixes #3741 

Added hash scroll handling directly in the React `Transitioner`
component's `onResolved`, similar to how it's implemented in the Solid
version
2025-04-02 20:37:36 +02:00
Ehtisham Sajjad
dbfea0d08c
docs(router): simplify route variable naming in search params guide (#3890)
In the "search params" guide, the usage of the variable
`allProductsRoute` has been changed to `Route` in the code-block
examples for consistency and clarity.
This makes the examples easier to follow since `Route` is used
throughout the rest of the documentation.
2025-04-02 09:07:41 +13:00
Tanner Linsley
9ca08f4756 release: v1.114.32 v1.114.32 2025-04-01 14:24:37 +00:00
Christopher Horobin
fb99d92ca8
fix(router-core): remove React type dependency (#3902) 2025-04-01 16:23:06 +02:00
Diego Garcia Brisa
eab355aa69
docs: Fix HeadContent docs (#3905)
## Changes

1. **Fix createRootRoute syntax**: Updated all examples in the document
head management guide to use the correct `createRootRoute({...})` syntax
instead of the incorrect `createRootRoute()({...})` syntax.

2. **Fix HeadContent placement**: The previous commit corrected the code
example for Single-Page Applications to properly show the correct syntax
for creating a root route with HeadContent.

## Why these changes matter

- The incorrect syntax examples could lead to confusion for developers
implementing document head management in their applications
- These fixes ensure consistency throughout the documentation and
provide developers with the correct implementation patterns
- Proper documentation helps reduce support requests and improves
developer experience

## Technical details

- Fixed 5 instances of incorrect `createRootRoute()({...})` syntax
throughout the document
- Previously fixed the SPA example which had an incorrect API reference

These changes ensure that all code examples in the document head
management guide are correct and consistent with the actual API
implementation.
2025-04-01 10:21:46 +02:00
Redbird10
1bbe4a062a
docs(router): correct ReturnType of Router.matchRoute to match the runtime output (#3896)
The `.matchRoute` method on the Router type page previously stated it
returns a `RouteMatch` object. In reality, it returns only the route
match's params.

This update corrects the return type in docs to reflect actual behavior.

Fix #3875
2025-04-01 11:13:23 +13:00
renovate[bot]
d0bbf662e5
chore(deps): update dependency vite to v6.1.3 [security] (#3900)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [vite](https://vite.dev)
([source](https://redirect.github.com/vitejs/vite/tree/HEAD/packages/vite))
| [`6.1.2` ->
`6.1.3`](https://renovatebot.com/diffs/npm/vite/6.1.2/6.1.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/vite/6.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite/6.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite/6.1.2/6.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite/6.1.2/6.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

### GitHub Vulnerability Alerts

####
[CVE-2025-31125](https://redirect.github.com/vitejs/vite/security/advisories/GHSA-4r4m-qw57-chr8)

### Summary

The contents of arbitrary files can be returned to the browser.

### Impact
Only apps explicitly exposing the Vite dev server to the network (using
`--host` or [`server.host` config
option](https://vitejs.dev/config/server-options.html#server-host)) are
affected.

### Details

- base64 encoded content of non-allowed files is exposed using
`?inline&import` (originally reported as `?import&?inline=1.wasm?init`)
- content of non-allowed files is exposed using `?raw?import`

`/@&#8203;fs/` isn't needed to reproduce the issue for files inside the
project root.

### PoC

Original report (check details above for simplified cases):

The ?import&?inline=1.wasm?init ending allows attackers to read
arbitrary files and returns the file content if it exists. Base64
decoding needs to be performed twice
```
$ npm create vite@latest
$ cd vite-project/
$ npm install
$ npm run dev
```

Example full URL
`http://localhost:5173/@&#8203;fs/C:/windows/win.ini?import&?inline=1.wasm?init`

---

### Release Notes

<details>
<summary>vitejs/vite (vite)</summary>

###
[`v6.1.3`](https://redirect.github.com/vitejs/vite/releases/tag/v6.1.3)

[Compare
Source](https://redirect.github.com/vitejs/vite/compare/v6.1.2...v6.1.3)

Please refer to
[CHANGELOG.md](https://redirect.github.com/vitejs/vite/blob/v6.1.3/packages/vite/CHANGELOG.md)
for details.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no
schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/TanStack/router).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-31 22:02:41 +00:00
Tanner Linsley
fdc7ddeb22 release: v1.114.31 v1.114.31 2025-03-31 21:15:51 +00:00
Sean Cassiere
e9b253ebfd
fix(router-plugin): code-splitting to handle default exported function declarations (#3901)
Currently, when the code-splitter encounters a known identifier used for
configuration in `createFileRoute` (such as `component`, `loader`,
`errorComponent`, etc.) it retains the export without splitting it out
into a separate file.

This functionality is currently partially working when the export is a
"default export" which references an already declared identifier.

```ts
const loader = () => {}
export default loader
```

However, it does not work when the "default export" is also making a
function declaration for the export.

```ts
export default function loader() {}
```

This PR adds the functionality to detect this use case and perform the
same transformations to align itself with the behaviour for all others
exports.
2025-04-01 10:14:32 +13:00
Birk Skyum
0394b6b668
fix(router-devtools-core): remove floating panel style on close (#3898) 2025-03-31 16:18:24 +02:00
Adam
1f2e243530
docs(start): add note on needing variable export named as APIRoute (#3892)
Just a quick note to prevent hitting 404s where the export needs to be named `APIRoute`.

---------

Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-03-31 21:23:31 +13:00
Tanner Linsley
2bed2c21f4 release: v1.114.30 v1.114.30 2025-03-29 16:27:28 +00:00
Manuel Schiller
1cb9443912
fix: bump babel-dead-code-elimination (#3881)
fixes #3824
2025-03-29 17:25:03 +01:00
SeanCassiere
ab0173dddb
docs(start): update the list to the router examples 2025-03-30 00:29:39 +13:00
Maradona Morais
f1b2d001fa
docs(router): fix _pathlessLayout example of file-based routing (#3877)
The `_pathlessLayout.tsx` should be the same name as the directory
`_pathlessLayout` in order to be applied as Layout for `route-a` and
`route-b` routes
2025-03-28 18:52:54 +01:00
Neeraj Dalal
3652b3529d
docs(start): switch from degit to gitpick (#3863)
Degit is both slower and has some odd caching behaviour on the user's machine.
Gitpick is faster and conforms to more native github URLs.
2025-03-28 05:09:44 +13:00
Birk Skyum
7155c42e9e
chore(docs): fix escaping of brackets in solid overview page (#3866)
addressing
https://github.com/TanStack/router/pull/3864#discussion_r2015283936
2025-03-27 03:34:58 +01:00
Tanner Linsley
c67c0e1f3a release: v1.114.29 v1.114.29 2025-03-27 00:35:38 +00:00
Birk Skyum
79a046e0d5 fix: RELEASE_ALL 2025-03-27 01:25:37 +01:00