Skip to content

Commit 6a97386

Browse files
chore: merge main (#4283)
1 parent baef562 commit 6a97386

File tree

14 files changed

+678
-24
lines changed

14 files changed

+678
-24
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,6 @@ vite.config.ts.timestamp_*
7474
# Handling VSCode settings
7575
/.vscode/
7676
!/examples/react/**/.vscode/settings.json
77-
**/.tanstack-start/build
77+
**/.tanstack-start/build
78+
79+
**/llms

docs/router/framework/react/api/router/RouteOptionsType.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ type beforeLoad = (
124124
```tsx
125125
type loader = (
126126
opts: RouteMatch & {
127-
search: TFullSearchSchema
128127
abortController: AbortController
129-
preload: boolean
130-
params: TAllParams
128+
cause: 'enter' | 'stay'
131129
context: TAllContext
130+
deps: TLoaderDeps
132131
location: ParsedLocation
132+
params: TAllParams
133+
preload: boolean
134+
parentMatchPromise: Promise<MakeRouteMatchFromRoute<TParentRoute>>
133135
navigate: NavigateFn<AnyRoute> // @deprecated
134-
buildLocation: BuildLocationFn<AnyRoute>
135-
cause: 'enter' | 'stay'
136136
},
137137
) => Promise<TLoaderData> | TLoaderData | void
138138
```
@@ -142,6 +142,7 @@ type loader = (
142142
- This async function is called when a route is matched and passed the route's match object. If an error is thrown here, the route will be put into an error state and the error will be thrown during render. If thrown during a navigation, the navigation will be canceled and the error will be passed to the `onError` function. If thrown during a preload event, the error will be logged to the console and the preload will fail.
143143
- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the `pendingComponent` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render.
144144
- If this function returns a `TLoaderData` object, that object will be stored on the route match until the route match is no longer active. It can be accessed using the `useLoaderData` hook in any component that is a child of the route match before another `<Outlet />` is rendered.
145+
- Deps must be returned by your `loaderDeps` function in order to appear.
145146
146147
> 🚧 `opts.navigate` has been deprecated and will be removed in the next major release. Use `throw redirect({ to: '/somewhere' })` instead. Read more about the `redirect` function [here](../redirectFunction.md).
147148
@@ -292,7 +293,7 @@ interface RemountDepsOptions<
292293
- The return value needs to be JSON serializable.
293294
- By default, a route component will not be remounted if it stays active after a navigation.
294295

295-
Example:
296+
Example:
296297
If you want to configure to remount a route component upon `params` change, use:
297298

298299
```tsx

docs/router/framework/react/guide/code-splitting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ If you are using code-based routing, you can still code-split your routes using
217217
Create a lazy route using the `createLazyRoute` function.
218218

219219
```tsx
220-
// src/posts.tsx
220+
// src/posts.lazy.tsx
221221
export const Route = createLazyRoute('/posts')({
222222
component: MyComponent,
223223
})

docs/router/framework/react/guide/scroll-restoration.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ const router = createRouter({
1717
})
1818
```
1919

20+
For complex selectors that cannot be simply resolved using `document.querySelector(selector)`, you can pass functions that return HTML elements to `routerOptions.scrollToTopSelectors`:
21+
22+
```tsx
23+
const selector = () =>
24+
document
25+
.querySelector('#shadowRootParent')
26+
?.shadowRoot?.querySelector('#main-scrollable-area')
27+
28+
const router = createRouter({
29+
scrollToTopSelectors: [selector],
30+
})
31+
```
32+
2033
These selectors are handled **in addition to `window`** which cannot be disabled currently.
2134

2235
## Scroll Restoration

docs/router/framework/react/installation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ TypeScript is _optional_, but **HIGHLY** recommended! If you are using it, pleas
3333

3434
> [!IMPORTANT]
3535
> We aim to support the last five minor versions of TypeScript. If you are using an older version, you may run into issues. Please upgrade to the latest version of TypeScript to ensure compatibility. We may drop support for older versions of TypeScript, outside of the range mentioned above, without warning in a minor or patch release.
36+
37+
### Vibe Coding Support
38+
39+
All of our documentation for TanStack React Router is integrated into the NPM module and can be easily installed as Vibe coding rules. You can integrate Vibe coding rules into the editor of your choice using [vibe-rules](https://www.npmjs.com/package/vibe-rules).
40+
41+
```bash
42+
pnpm add -g vibe-rules
43+
```
44+
45+
Then run `vibe-rules` with the editor of your choice. Here is an example for Cursor:
46+
47+
```bash
48+
vibe-rules install cursor
49+
```
50+
51+
But you can also use `windsurf`, `claude-code`, etc. Check the [vibe-rules](https://www.npmjs.com/package/vibe-rules) documentation for more information.

docs/router/framework/react/routing/file-based-routing.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ See the example below:
4747
| ┄ ʦ `route-b.tsx` | `/route-b` | `<Root><PathlessLayout><RouteB>` |
4848
| 📂 `files` | | |
4949
| ┄ ʦ `$.tsx` | `/files/$` | `<Root><Files>` |
50+
| 📂 `account` | | |
51+
| ┄ ʦ `route.tsx` | `/account` | `<Root><Account>` |
52+
| ┄ ʦ `overview.tsx` | `/account/overview` | `<Root><Account><Overview>` |
5053

5154
## Flat Routes
5255

@@ -72,6 +75,8 @@ See the example below:
7275
| ʦ `_pathlessLayout.route-a.tsx` | `/route-a` | `<Root><PathlessLayout><RouteA>` |
7376
| ʦ `_pathlessLayout.route-b.tsx` | `/route-b` | `<Root><PathlessLayout><RouteB>` |
7477
| ʦ `files.$.tsx` | `/files/$` | `<Root><Files>` |
78+
| ʦ `account.tsx` | `/account` | `<Root><Account>` |
79+
| ʦ `account.overview.tsx` | `/account/overview` | `<Root><Account><Overview>` |
7580

7681
## Mixed Flat and Directory Routes
7782

@@ -92,6 +97,8 @@ See the example below:
9297
| ʦ `settings.tsx` | `/settings` | `<Root><Settings>` |
9398
| ʦ `settings.profile.tsx` | `/settings/profile` | `<Root><Settings><Profile>` |
9499
| ʦ `settings.notifications.tsx` | `/settings/notifications` | `<Root><Settings><Notifications>` |
100+
| ʦ `account.tsx` | `/account` | `<Root><Account>` |
101+
| ʦ `account.overview.tsx` | `/account/overview` | `<Root><Account><Overview>` |
95102

96103
Both flat and directory routes can be mixed together to create a route tree that uses the best of both worlds where it makes sense.
97104

docs/start/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
{
8181
"label": "Path Aliases",
8282
"to": "framework/react/path-aliases"
83+
},
84+
{
85+
"label": "Migrate from Next.js",
86+
"to": "framework/react/migrate-from-next-js"
8387
}
8488
]
8589
},

0 commit comments

Comments
 (0)