Skip to content

Commit ec661f4

Browse files
committed
fix: address PR review comments on skill files
- Fix incorrect createTanstackRouter → createRouter in router-query examples - Fix missing React type imports (ComponentPropsWithoutRef, FormEvent) - Fix hardcoded localhost:3000 in SSR example, use req headers instead - Fix session.update/clear to use await with data payload - Fix start-setup → start-core slug mismatch in domain_map + skill_spec - Make start-client-core skill_tree self-contained (remove react-start refs) - Add framework-agnostic comments to execution-model and middleware skills - Make virtual-file-routes vite example framework-agnostic - Fix solid-router domain_map: Link is primary, createLink for wrappers - Fix vue-router domain_map: scope Ref unwrapping to script, not templates - Fix vue-router SKILL.md: tsx → vue fence language for template snippets - Fix virtual-file-routes domain_map failure mode wording - Fix MD028 blockquote blank lines across 11 files - Fix MD040 missing fence languages across 4 files - Update pnpm-lock.yaml
1 parent 142682c commit ec661f4

34 files changed

Lines changed: 108 additions & 119 deletions

File tree

‎packages/react-router/bin/intent.js‎

100644100755
File mode changed.

‎packages/react-router/skills/compositions/router-query/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ A module-level singleton `QueryClient` is shared across all server requests, lea
341341
// WRONG — shared across SSR requests
342342
const queryClient = new QueryClient()
343343
export function createRouter() {
344-
return createTanstackRouter({
344+
return createRouter({
345345
routeTree,
346346
context: { queryClient },
347347
})
@@ -350,7 +350,7 @@ export function createRouter() {
350350
// CORRECT — new QueryClient per createRouter call
351351
export function createRouter() {
352352
const queryClient = new QueryClient()
353-
return createTanstackRouter({
353+
return createRouter({
354354
routeTree,
355355
context: { queryClient },
356356
})

‎packages/react-router/skills/lifecycle/migrate-from-react-router/SKILL.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ sources:
2121
This is a step-by-step migration checklist. Each check covers one conversion task. Complete them in order.
2222

2323
> **CRITICAL**: If your UI is blank after migration, open the console. Errors like "cannot use useNavigate outside of context" mean React Router imports remain alongside TanStack Router imports. Uninstall `react-router` to surface them as TypeScript errors.
24-
2524
> **CRITICAL**: TanStack Router uses `to` + `params` for navigation, NOT template literal paths. Never interpolate params into the `to` string.
2625
2726
## Pre-Migration
@@ -459,7 +458,7 @@ const { page } = Route.useSearch()
459458

460459
### 4. MEDIUM: Using `:param` syntax instead of `$param`
461460

462-
```
461+
```text
463462
React Router: /posts/:postId
464463
TanStack Router: /posts/$postId
465464
```

‎packages/react-router/skills/react-router/SKILL.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ This skill builds on router-core. Read [router-core](../../../router-core/skills
2727
This skill covers the React-specific bindings, components, hooks, and setup for TanStack Router.
2828

2929
> **CRITICAL**: TanStack Router types are FULLY INFERRED. Never cast, never annotate inferred values.
30-
3130
> **CRITICAL**: TanStack Router is CLIENT-FIRST. Loaders run on the client by default, not on the server.
32-
3331
> **CRITICAL**: Do not confuse `@tanstack/react-router` with `react-router-dom`/`react-router`. They are completely different libraries with different APIs.
3432
3533
## Full Setup: File-Based Routing with Vite
@@ -362,11 +360,11 @@ Wrap `Link` in a custom component while preserving type safety:
362360

363361
```tsx
364362
import { createLink } from '@tanstack/react-router'
365-
import { forwardRef } from 'react'
363+
import { forwardRef, type ComponentPropsWithoutRef } from 'react'
366364

367365
const StyledLinkComponent = forwardRef<
368366
HTMLAnchorElement,
369-
React.ComponentPropsWithoutRef<'a'>
367+
ComponentPropsWithoutRef<'a'>
370368
>((props, ref) => (
371369
<a ref={ref} {...props} className={`styled-link ${props.className ?? ''}`} />
372370
))

‎packages/react-start/bin/intent.js‎

100644100755
File mode changed.

‎packages/router-core/skills/router-core/auth-and-guards/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export const Route = createFileRoute('/_authenticated')({
151151
```tsx
152152
// src/routes/login.tsx
153153
import { createFileRoute, redirect } from '@tanstack/react-router'
154-
import { useState } from 'react'
154+
import { useState, type FormEvent } from 'react'
155155

156156
export const Route = createFileRoute('/login')({
157157
validateSearch: (search) => ({
@@ -173,7 +173,7 @@ function LoginComponent() {
173173
const [password, setPassword] = useState('')
174174
const [error, setError] = useState('')
175175

176-
const handleSubmit = async (e: React.FormEvent) => {
176+
const handleSubmit = async (e: FormEvent) => {
177177
e.preventDefault()
178178
try {
179179
await auth.login(username, password)

‎packages/router-core/skills/router-core/not-found-and-errors/SKILL.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ sources:
2020
TanStack Router handles two categories of "not found": unmatched URL paths (automatic) and missing resources like a post that doesn't exist (manual via `notFound()`). Error boundaries are configured per-route via `errorComponent`.
2121

2222
> **CRITICAL**: Do NOT use the deprecated `NotFoundRoute`. When present, `notFound()` and `notFoundComponent` will NOT work. Remove it and use `notFoundComponent` instead.
23-
2423
> **CRITICAL**: `useLoaderData` may be undefined inside `notFoundComponent`. Use `useParams`, `useSearch`, or `useRouteContext` instead.
2524
2625
## Not Found Handling

‎packages/router-core/skills/router-core/search-params/SKILL.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ sources:
2424
TanStack Router treats search params as JSON-first application state. They are automatically parsed from the URL into structured objects (numbers, booleans, arrays, nested objects) and validated via `validateSearch` on each route.
2525

2626
> **CRITICAL**: Use `fallback()` from `@tanstack/zod-adapter`, NOT zod's `.catch()`. Using `.catch()` makes the output type `unknown`, destroying type safety.
27-
2827
> **CRITICAL**: Types are fully inferred. Never annotate the return of `useSearch()`.
2928
3029
## Setup: Zod Adapter (Recommended)

‎packages/router-core/skills/router-core/ssr/SKILL.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ export async function render({
317317
req: express.Request
318318
res: express.Response
319319
}) {
320-
const url = new URL(req.originalUrl || req.url, 'https://localhost:3000').href
320+
const protocol = req.get('x-forwarded-proto') ?? req.protocol
321+
const host = req.get('x-forwarded-host') ?? req.get('host')
322+
const url = new URL(req.originalUrl || req.url, `${protocol}://${host}`).href
321323

322324
const request = new Request(url, {
323325
method: req.method,

‎packages/router-core/skills/router-core/type-safety/SKILL.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ sources:
2222
TanStack Router is FULLY type-inferred. Params, search params, context, and loader data all flow through the route tree automatically. The **#1 AI agent mistake** is adding type annotations, casts, or generic parameters to values that are already inferred.
2323

2424
> **CRITICAL**: NEVER use `as Type`, explicit generic params, `satisfies` on hook returns, or type annotations on inferred values. Every cast masks real type errors and breaks the inference chain.
25-
2625
> **CRITICAL**: Do NOT confuse TanStack Router with Next.js or React Router. There is no `getServerSideProps`, no `useSearchParams()`, no `useLoaderData()` from `react-router-dom`.
2726
2827
## The ONE Required Type Annotation: Register
@@ -497,4 +496,4 @@ export const Route = createFileRoute('/posts')({
497496
const search = Route.useSearch() // TanStack hook
498497
```
499498

500-
See also: router-core (Register setup), router-core/navigation (from narrowing), router-core/code-splitting (getRouteApi).
499+
See also: router-core (Register setup), router-core/navigation (from narrowing), router-core/code-splitting (getRouteApi).

0 commit comments

Comments
 (0)