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

6,473 commits

Author SHA1 Message Date
Flo
916253ad2d
refactor(router-core): Reduce navigation work by making some properties non-reactive (#4916)
Some of the properties of a route match in the store do not need to be
reactive (i.e. reactive = trigger the execution of all subscribers when
they change).

This PR proposes we add a `_nonReactive` key for storing these
properties.

Changes to properties in `_nonReactive` can be made like on a regular
object, without the need to call `__store.setState`, and without making
a shallow copy of the object.

The following properties were moved to `_nonReactive` (but more would be
welcome if we can find which ones):
- `beforeLoadPromise`
- `loaderPromise`
- `pendingTimeout`
- `loadPromise`
- `displayPendingPromise`
- `minPendingPromise`
- `dehydrated`

This results in the removal of 4 `updateMatch` calls in `router-core`.
At least 1 of which is in the hot-path of a navigation (`loadMatches` >
`validResolvedMatches.forEach`). And the removal of 2 `updateMatch`
calls in `packages/react-router/src/Match.tsx` (and solid-router too).

The `ssr` property was also updated to not be reactive, but kept outside
of `_nonReactive` because it is part of the public API. This removes
another call to `updateMatch`. This key is an exception, and if in the
future we find a need to have more "public but non-reactive" properties,
we could consider
- hiding internal props in a separate type, or
- adding a dev proxy to ensure non-reactive props aren't accessed inside
`select` functions

---

This PR adds a unit-test in `react-router` that counts how many times
the `select` inside a `useRouterState` hook is called during a
navigation. Without this PR, the result of this test is **26 calls**.
With this PR, we're down to **19 calls**.

---

Should be a partial improvement of
https://github.com/TanStack/router/issues/4359

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-11 13:59:36 +02:00
Abdullah Al-taheri
fe43f1bf53
docs: Update static-prerendering.md (#4903)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-11 01:53:44 +02:00
Tanner Linsley
cf99c6a3f4 release: v1.131.3 v1.131.3 2025-08-10 21:40:01 +00:00
Flo
fd341ad200
refactor(router-core): strip internal types from public build (#4907)
This PR proposes we use the `@internal` JSDoc tag, and `--stripInternal`
typescript compiler option to remove internal keys from the public
`.d.ts` files.

Docs for `stripInternal`:
https://www.typescriptlang.org/tsconfig/#stripInternal

This helps ensuring internal values aren't considered as part of the
*public API surface* by users, allowing us more flexibility in
refactoring.

> [!WARNING]
> This PR proposes we add `stripInternal` to the entire repo, not just
`router-core`. However there are already some values marked as internal
that weren't added by this PR:
> - `InferStructuralSharing` in `react-router`
> - `handleHashScroll` in `router-core > scrollRestoration`
> - many `InferFoo` types in `router-core > typePrimitives`
>
> as a result of this, we might have to switch some of those `@internal`
tags to something else (like `@private` maybe?) because they are, in
fact, necessary for the build to be correct.

Example:
```ts
export type Foo = {
  a: number,
  /** @internal */
  b: number,
}

/** @internal */
export function hello() {
  return 'world'
}

export const answer = 42
```
gets compiled as `.d.ts` to
```ts
export type Foo = {
  a: number
}
export const answer = 42
```

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-10 23:38:37 +02:00
Adam Rackis
3023706938
Update getting-started.md (#4909)
Add TanStack Start CLI option
2025-08-10 09:14:53 -07:00
Tanner Linsley
ef74fc661b release: v1.131.2 v1.131.2 2025-08-08 23:39:20 +00:00
Manuel Schiller
d063dd6707
fix: RELEASE_ALL (#4896) 2025-08-09 01:35:02 +02:00
Tanner Linsley
7bb4673046 release: v1.131.1 v1.131.1 2025-08-08 23:31:50 +00:00
Manuel Schiller
36f3253dc1
fix: publish package (#4895) 2025-08-09 01:30:26 +02:00
Lee
238c63f36d
docs(router): update links in how-to guides (#4878) 2025-08-09 00:46:51 +02:00
Tanner Linsley
c94fa35de1 release: v1.131.0 v1.131.0 2025-08-08 21:53:49 +00:00
Manuel Schiller
90adfe919e
feat: restructure query-integration (#4643)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-08 23:52:29 +02:00
Tanner Linsley
cc499c3b92 release: v1.130.17 v1.130.17 2025-08-08 21:37:57 +00:00
Tanner Linsley
e75531647a
fix: do not pre-decodeURI before passing to createMemoryHistory (#4893)
fixes #4514
2025-08-08 15:36:37 -06:00
Abdulhamit Akaslan
0a3bb242af
chore(examples): remove unnecessary opts.deps (#4879) 2025-08-08 16:08:08 +12:00
Tanner Linsley
bb5206ada4 release: v1.130.16 v1.130.16 2025-08-07 21:38:28 +00:00
Ali Idrizi
2cfadef90d
fix(router-generator): use the tmpDir when genearting a temporary filename (#4882) 2025-08-07 23:32:57 +02:00
Diogo Lessa
8efac91d6d
docs(router): fix typo in overview.md (#4863) 2025-08-03 20:37:07 +02:00
Zack
2ca59db492
examples: removes Tailwind from start-bare example (#4809)
The `start-bare` example includes Tailwind with a broken config (missing
`tailwindcss()` in vite.config.ts plugins), which contradicts the 'bare'
concept. Since `start-tailwind-v4` already provides a properly
configured Tailwind example, this PR removes Tailwind from `start-bare`
to make it actually bare.
2025-08-02 14:40:12 +02:00
Kilian Finger
57bac254f2
examples: @mui/material example re-add ssr.noExternal to vite config (#4861)
Fixes #4857
2025-08-02 11:44:38 +02:00
Tanner Linsley
2b20bfb6ca release: v1.130.15 v1.130.15 2025-08-02 05:33:26 +00:00
Manuel Schiller
85cba5526d
fix: do not create temp subdirectories for router generator (#4860) 2025-08-02 07:28:09 +02:00
Tanner Linsley
34014c6203 release: v1.130.14 v1.130.14 2025-08-02 05:04:00 +00:00
Manuel Schiller
6e191fdd83
fix: account for exports being a string (#4859)
fixes #4858
2025-08-02 07:00:05 +02:00
Adam Bouqdib
75615f3994
docs(start): fix cloudflare-workers deployment using wrangler.toml (#4779) 2025-08-02 13:07:49 +12:00
Tanner Linsley
e8599c6c66 release: v1.130.13 v1.130.13 2025-08-02 00:59:53 +00:00
JamesHyot
12732fed48
refactor(router-devtools-core): allow styling of TanStackRouterDevtoolsPanel (#4671) 2025-08-02 12:54:14 +12:00
Tanner Linsley
cd1de7edb7 release: v1.130.12 v1.130.12 2025-08-01 20:38:24 +00:00
Manuel Schiller
db2b2c4bfc
fix: do not add ESM deps to optimizeDeps without a '.' export (#4855) 2025-08-01 22:30:15 +02:00
Manuel Schiller
4e2605a26d
chore: bump typescript version (#4853) 2025-08-01 22:30:02 +02:00
Tanner Linsley
eb4d982605 release: v1.130.11 v1.130.11 2025-08-01 17:37:00 +00:00
Flo
c1f6dfe0ac
fix(router-core): processRouteTree orders routes w/ prefix / suffix based on their lengths (#4850)
When ordering routes to determine "which one will match in priority", we
try to follow the "more specific 1st" principle.

Currently, 2 routes with the same pattern, but with prefixes of
different lengths, are counted as having the same specificity, and thus
are not re-ordered. For example:
- `/f{$param}`
- `/foo{$param}`

In this case, assuming `f{$param}.tsx` is returned 1st by the OS when
listing route files (which it is by alphabetical order), a path
`/foobar` will match `/f{$param}`.

This PR proposes we take the `length` of the `prefix` and `suffix` into
account when sorting routes. In this example this would mean
`/foo{$param}` takes priority because it is considered more specific.
2025-08-01 19:30:52 +02:00
Tanner Linsley
9061654052 release: v1.130.10 v1.130.10 2025-08-01 08:18:41 +00:00
Chris
7c6b5752ea
refactor(router-core,start-server-core): improve JSDocs for redirect (#4848)
Co-authored-by: Christopher Menendez <chris@Christophers-MacBook-Pro.local>
2025-08-01 20:13:06 +12:00
Chris
d5fd30f98a
docs(router): update URL for Query (#4849)
Co-authored-by: Christopher Menendez <chris@Christophers-MacBook-Pro.local>
2025-08-01 20:12:50 +12:00
Nico Lynzaad
cb0478a2a8
docs(router): usage of "." and ".." for relative navigation (#4846) 2025-08-01 20:12:42 +12:00
Lee
3ca2a293b2
docs(router): usage of routeFilePrefix for file-based routing (#4845) 2025-08-01 20:12:30 +12:00
Dimitris Karagiannis
f3a594794a
docs(router): list preload as navigation cause value (#4825) 2025-08-01 20:12:21 +12:00
Matthew Hart
87d4ccb67c
docs(start): incorrect usage of scripts in the "document head management" guide (#4801) 2025-08-01 19:58:10 +12:00
Tanner Linsley
91e404b1e2 release: v1.130.9 v1.130.9 2025-07-30 22:02:09 +00:00
Manuel Schiller
ce9e37366a
fix: correctly match routes with optional path params followed by req… (#4838)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-31 00:00:49 +02:00
autofix-ci[bot]
14ad18f3db
ci: apply automated fixes 2025-07-30 17:10:04 +00:00
Tanner Linsley
bf12ba8e3e
docs: search param sharing/inheritance how-to
Add 'Share Search Parameters Across Routes' how-to guide to complete the
next step in the Progressive Search Params Series.

---
<a
href="https://cursor.com/background-agent?bcId=bc-b62364d8-aa89-47bd-a3f5-d8724879c0ca">
  <picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg">
<source media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg">
<img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg">
  </picture>
</a>
<a
href="https://cursor.com/agents?id=bc-b62364d8-aa89-47bd-a3f5-d8724879c0ca">
  <picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg">
<source media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg">
    <img alt="Open in Web" src="https://cursor.com/open-in-web.svg">
  </picture>
</a>

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-30 11:09:18 -06:00
Sean Cassiere
7f290adb41
docs: add frontmatter to the "how-to" guides (#4835) 2025-07-30 20:04:05 +12:00
Lee
127944f042
docs: update links authentication setup guides (#4834) 2025-07-30 19:52:53 +12:00
Tanner Linsley
d6a3881ef4 release: v1.130.8 v1.130.8 2025-07-29 20:56:53 +00:00
Flo
2e40d0142f
refactor(router-core): router clearExpiredCache variable naming mistake (#4831)
Just correcting a variable naming mistake I made in
https://github.com/TanStack/router/pull/4826 because I confused
`staleTime` and `gcTime`.
2025-07-29 22:51:11 +02:00
Tanner Linsley
4bb5674f51 release: v1.130.7 v1.130.7 2025-07-29 20:47:26 +00:00
Flo
dafad2a330
refactor(router-core): router uses .some() over .find() for boolean results (#4829)
This change is a no-op, even in terms of performance. But it's more of
an "anti-slippery-slope" measure, so we don't end up with array copying
methods like `.map` or `.filter` being used instead of simpler methods
like `.find` or `.some`
2025-07-29 22:41:48 +02:00
Tanner Linsley
106e03022b release: v1.130.6 v1.130.6 2025-07-29 20:37:49 +00:00