0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-18 19:34:24 +00:00
Commit graph

6,608 commits

Author SHA1 Message Date
Tanner Linsley
8b53a9a177
docs: basic search params how-to
Add 'Navigate with Search Parameters' how-to guide covering various
navigation methods for search parameters.

This guide details how to update and manage search parameters using both
Link components and programmatic navigation (`useNavigate`, router
instance). It covers basic and functional updates, navigation with route
changes, advanced patterns like conditional navigation and validation,
common UI patterns (search results, filters, breadcrumbs), and addresses
common problems like losing parameters or serialization issues.

---

[Open in
Web](https://cursor.com/agents?id=bc-38c6eb35-f409-43fc-ac4c-323097fb478b)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-38c6eb35-f409-43fc-ac4c-323097fb478b)
• [Open Docs](https://docs.cursor.com/background-agent/web-and-mobile)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-28 15:17:57 -06:00
autofix-ci[bot]
4a1edf695a
ci: apply automated fixes 2025-07-28 20:20:39 +00:00
Tanner Linsley
21300374f6
docs: basic search params how-to
Adds the initial 'Set Up Basic Search Parameters' how-to guide,
recommending any standard schema-compliant validation library, and
updates documentation plans.

---

[Open in
Web](https://cursor.com/agents?id=bc-795e5be2-bf8c-4433-8e6d-72a98fb30a1d)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-795e5be2-bf8c-4433-8e6d-72a98fb30a1d)
• [Open Docs](https://docs.cursor.com/background-agent/web-and-mobile)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-28 14:19:43 -06:00
autofix-ci[bot]
fd62699815
ci: apply automated fixes 2025-07-28 19:18:28 +00:00
Tanner Linsley
71c95e6c8f docs: updates 2025-07-28 13:17:35 -06:00
Tanner Linsley
a790f61647 release: v1.130.3 v1.130.3 2025-07-28 16:58:19 +00:00
Manuel Schiller
d09f5daa74
fix: spa mode with prerendering (#4811)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-28 18:56:47 +02:00
David Williams
73ab338fe2
chore(root): update broken README links (#4789) 2025-07-28 20:47:06 +12:00
Tanner Linsley
0513f5ea4e release: v1.130.2 v1.130.2 2025-07-27 22:19:46 +00:00
Manuel Schiller
c8be12cd14
fix: prerending with SPA mode enabled renders all routes (#4800) 2025-07-28 00:18:26 +02:00
autofix-ci[bot]
de11338d8c
ci: apply automated fixes 2025-07-27 17:15:24 +00:00
notKamui
a08b600b66
docs: Runtime env docs (#4797)
With discussions with @schiller-manuel and the amount of time this issue
has been brought up on Discord, I feel adding precisions and more
explicit examples on how to deal with runtime env variables on the
client could help.

---------

Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
2025-07-27 11:14:40 -06:00
Hazem Tarek Elaswad
9374fac48f
docs: Update RouterOptionsType.md (#4796)
Change a typo in `basepath` property description.
2025-07-27 14:26:32 +02:00
Tanner Linsley
9dec9b78b1 release: v1.130.1 v1.130.1 2025-07-26 22:38:00 +00:00
Manuel Schiller
ec8069855e
fix: scroll to top with hash history (#4795) 2025-07-27 00:36:40 +02:00
Manuel Schiller
3c6633a705
chore: silence error in test (#4794)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-26 23:05:17 +02:00
Tanner Linsley
77fa17bdc0 release: v1.130.0 v1.130.0 2025-07-26 20:53:09 +00:00
Jaen
e83199310a
feat(react-router): add disableGlobalCatchBoundary option (#4765)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
2025-07-26 22:45:20 +02:00
Alvaro Sevilla
b39b8919a1
fix: pin all workspace dependencies and devDependencies (#4771) 2025-07-26 22:45:10 +02:00
Tanner Linsley
4c36401de5 release: v1.129.9 v1.129.9 2025-07-26 19:34:52 +00:00
Manuel Schiller
4318992ab8
chore: fix build in CI (#4790) 2025-07-26 21:28:55 +02:00
Manuel Schiller
be7a578547
fix: scroll to top if no scroll restoration entry exists (#4786) 2025-07-26 19:02:33 +02:00
Devon Govett
abad0a1e46
docs(react-router): update custom-link guide for react-aria (#4757)
As of [React Aria Components
v1.11.0](https://react-spectrum.adobe.com/releases/2025-07-22.html), we
now pass through DOM events, so it's no longer necessary to use hooks to
create a custom link component. You can just use `createLink` with the
React Aria component directly.


[Demo](https://stackblitz.com/edit/stackblitz-starters-qc66mmzn?file=src%2FLink.tsx)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-26 17:23:40 +02:00
Lachlan Collins
a89408affd
chore: sync TanStack repo changes (#4784)
## 🎯 Changes

- Update Prettier and use experimental CLI
- Update Nx to v21
- Fix bug in test exposed by new prettier version
- Sync issues template

## ✅ Checklist

- [x] I have followed the steps listed in the [Contributing
guide](https://github.com/TanStack/config/blob/main/CONTRIBUTING.md).
- [x] I have tested and linted this code locally.
2025-07-26 21:55:38 +10:00
Tanner Linsley
4f802cf1c0
docs: env vars (#4777)
Add a detailed plan for a new 'How to Use Environment Variables' guide
because it addresses a critical and frequently asked topic that is
currently under-documented.

---

[Open in
Web](https://cursor.com/agents?id=bc-7c882ddb-7215-41c7-9ef1-32f42f212449)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-7c882ddb-7215-41c7-9ef1-32f42f212449)

Learn more about [Background
Agents](https://docs.cursor.com/background-agent/web-and-mobile)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-25 16:50:39 -06:00
autofix-ci[bot]
a8ea2b838c
ci: apply automated fixes 2025-07-25 20:20:55 +00:00
Tanner Linsley
ecfe14bc1f
docs: how-to guide for file-based router testing (#4776)
Add a new how-to guide for testing TanStack Router with file-based
routing to cover specific patterns and challenges.

---

[Open in
Web](https://cursor.com/agents?id=bc-ee0f6db1-18b2-4c3b-b69c-13ea7f849190)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-ee0f6db1-18b2-4c3b-b69c-13ea7f849190)

Learn more about [Background
Agents](https://docs.cursor.com/background-agent/web-and-mobile)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-25 14:19:51 -06:00
autofix-ci[bot]
1d34e56792
ci: apply automated fixes 2025-07-25 20:12:00 +00:00
Tanner Linsley
94ec310682
docs: more! (#4775)
Add comprehensive authentication, testing, and debugging how-to guides
to enhance documentation.

---

[Open in
Web](https://cursor.com/agents?id=bc-ea21e97d-685a-451f-9700-6955d86ef170)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-ea21e97d-685a-451f-9700-6955d86ef170)

Learn more about [Background
Agents](https://docs.cursor.com/background-agent/web-and-mobile)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-25 14:10:52 -06:00
autofix-ci[bot]
1cd28688c7
ci: apply automated fixes (attempt 2/3) 2025-07-25 19:16:09 +00:00
autofix-ci[bot]
cb08dd6f6a
ci: apply automated fixes 2025-07-25 19:15:11 +00:00
Tanner Linsley
269625a5a7
docs: Split ui library documentation into guides (#4774)
Split the UI library integration guide into individual how-to guides for
Shadcn/ui, Material-UI, Framer Motion, and Chakra UI.

---

[Open in
Web](https://cursor.com/agents?id=bc-8573175f-c315-4c20-a848-fc2e39ef00eb)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-8573175f-c315-4c20-a848-fc2e39ef00eb)

Learn more about [Background
Agents](https://docs.cursor.com/background-agent/web-and-mobile)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-25 13:14:06 -06:00
autofix-ci[bot]
4c18a66936
ci: apply automated fixes 2025-07-25 19:04:33 +00:00
Tanner Linsley
d7d9d4e8cc
docs: migrate from react router v6
Add a comprehensive migration guide from React Router v7 to TanStack
Router, addressing feedback to target the latest version.

The original PR #4704 aimed to provide a migration guide from React
Router v6. However, a comment from schiller-manuel questioned why v6 was
targeted instead of v7. This PR updates the scope to focus on React
Router v7, which was released in November 2024 and is the current
version, ensuring the guide is relevant for users migrating from the
latest React Router.

---

[Open in
Web](https://cursor.com/agents?id=bc-035967dd-2396-4ba3-9226-f0bfd1c21f11)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-035967dd-2396-4ba3-9226-f0bfd1c21f11)

Learn more about [Background
Agents](https://docs.cursor.com/background-agent/web-and-mobile)

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-25 13:03:25 -06:00
autofix-ci[bot]
38073cb5e9
ci: apply automated fixes 2025-07-25 18:51:55 +00:00
Tanner Linsley
2703b7fcf0
docs: how-to SSR guide
Add a comprehensive "How to Set Up Server-Side Rendering (SSR)" guide to
provide practical, step-by-step instructions and address feedback from
PR #4703.

The previous PR #4703 aimed to add an SSR setup guide but had concerns
regarding overlap with an existing conceptual SSR guide and specific
technical implementation details (e.g., streaming SSR, Vite config).
This PR addresses those concerns by creating a distinct, practical
"how-to" guide with complete code examples, troubleshooting, and a clear
recommendation for TanStack Start, while ensuring it complements the
existing theoretical guide.

---

[Open in
Web](https://cursor.com/agents?id=bc-8555f196-638f-4bec-90a4-5eac52b5918a)
• [Open in
Cursor](https://cursor.com/background-agent?bcId=bc-8555f196-638f-4bec-90a4-5eac52b5918a)

Learn more about [Background
Agents](https://docs.cursor.com/background-agent/web-and-mobile)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-25 12:50:56 -06:00
Karthik Appiah
b38c42e753
docs(start): add missing dev dep to build-from-scratch guide (#4758) 2025-07-25 09:07:35 +12:00
SeanCassiere
6a89d3c048
chore(root): fix missing speakeasy logo 2025-07-24 10:17:14 +12:00
Manuel Schiller
3b9128e502
docs: slight correction in automatic code splitting 2025-07-23 20:43:30 +02:00
Lee
68fd70bf8e
docs(router): update types for RouteOptions and RouteMatch (#4754)
Closes #3811

---------

Signed-off-by: leesb971204 <leesb971204@gmail.com>
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-07-23 23:41:22 +12:00
Flo
58093828f2
test(router-core): add unit tests for matchByPath (#4749)
This PR is simply adding unit test to the existing `matchByPath`
function.

However, it does highlight some weird cases / bugs:

- this test passes OK, I'm just wondering whether that's a real case
that can happen (in which case the test is good to keep) or if it's just
accidental
  ```ts
expect(matchByPath('/', '/a/1/b/2', { to: '/a/$id/b/$id' })).toEqual({
id: '2' })
  ```

- this test passes OK, I'm just a little surprised that it includes a
`/` char, because *any other* case does not
  ```ts
expect(matchByPath('/', '/a/', { to: '/a/$' })).toEqual({ _splat: '/',
'*': '/' })
  ```

- this does NOT work, it seems like a bug with the recent optional
params
  ```ts
expect(matchByPath('/', '/a/b', { to: '/A/{-$id}/B', caseSensitive:
false })).toEqual({})
expect(matchByPath('/', '/a/b/2', { to: '/A/{-$id}/B/{-$other}',
caseSensitive: false })).toEqual({ other: '2' })
expect(matchByPath('/', '/a/b', { to: '/A/{-$id}/B/{-$other}',
caseSensitive: false })).toEqual({})
  ```

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-23 11:58:09 +02:00
Tanner Linsley
2de6dccebe release: v1.129.8 v1.129.8 2025-07-23 09:18:33 +00:00
Flo
182df4d316
refactor(router-core): add LRU cache in front of parsePathname (#4752)
We noticed that `parsePathname` is a performance bottleneck during
navigation events. Here's a flamegraph from an application w/ ~300
routes around a navigation event:

<img width="853" height="372" alt="Screenshot 2025-07-22 at 19 36 24"
src="https://github.com/user-attachments/assets/7ed2e09a-8ea9-4170-862a-2d53c3eb4793"
/>


This PR proposes a basic least-recently-used cache implementation (that
data structure is about 4-5x slower than a `Map` according to
benchmarks, and it uses a little more memory).

We can add caching to `parsePathname` now that what it returns is
readonly (https://github.com/TanStack/router/pull/4705), which should
improve the performance of this bottleneck.

The cache is set to a size of 1000. When / if we end up making a
pre-built matcher (WIP https://github.com/TanStack/router/pull/4714), we
maybe can reduce this size. But `parsePathname` is still called w/ built
pathnames so we probably shouldn't remove the cache entirely.


When benchmarking `matchPathname` with and without the cache, we notice
a ~9x increase in throughput with the cache.
```
 ✓  @tanstack/router-core  tests/cache.bench.ts > cache.bench 7191ms
     name             hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · original   1,795.61  0.5055  0.7022  0.5569  0.5604  0.6234  0.6464  0.7022  ±0.22%      898
   · cached    16,307.87  0.0562  0.2294  0.0613  0.0608  0.0767  0.1007  0.1152  ±0.17%     8154   fastest

 BENCH  Summary

   @tanstack/router-core  cached - tests/cache.bench.ts > cache.bench
    9.08x faster than original
```
Assuming this 9x increase translates to a proportional reduction of the
self-time seen in the flamegraph, it would go from 55ms to 6ms.
2025-07-23 11:16:59 +02:00
Leonardo Montini
1cd917659b
docs(router): using square brackets for character escaping (#4753) 2025-07-23 12:17:50 +12:00
Tanner Linsley
c35d414681 release: v1.129.7 v1.129.7 2025-07-23 00:13:31 +00:00
Manuel Schiller
4f930d1b80
fix: ensure unique matchId when optional and required param are on the same level (#4751) v1.129.6 2025-07-22 19:02:21 +02:00
Justin Mißmahl
d87ca5ecf4
docs: fix incorrect import path in automatic code splitting guide (#4745) 2025-07-22 18:04:23 +02:00
Tanner Linsley
ad420694a3 release: v1.129.5 v1.129.5 2025-07-22 15:38:46 +00:00
Dimitris Karagiannis
d485cc23d6
fix(router-core): type mismatch for navigate function (#4625)
According to the docs this should only return a promise
https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType#navigate-method
Makes sense otherwise you cannot .then() it

---------

Co-authored-by: Nico Lynzaad <44094871+nlynzaad@users.noreply.github.com>
2025-07-22 17:32:16 +02:00
Kamlesh Paul
be1b9e39b3
docs: typo in Server-Routes => Escaped Matching (#4741) 2025-07-22 17:12:30 +02:00