Skip to content

Commit e4d5671

Browse files
fix: various fixes (#5215)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 0683940 commit e4d5671

File tree

15 files changed

+58
-50
lines changed

15 files changed

+58
-50
lines changed

docs/router/integrations/query.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ title: TanStack Query Integration
1818
The TanStack query integration is a separate package that you need to install:
1919

2020
```sh
21-
npm install -D @tanstack/react-router-ssr-query
21+
npm install @tanstack/react-router-ssr-query
2222
# or
23-
pnpm add -D @tanstack/react-router-ssr-query
23+
pnpm add @tanstack/react-router-ssr-query
2424
# or
25-
yarn add -D @tanstack/react-router-ssr-query
25+
yarn add @tanstack/react-router-ssr-query
2626
# or
27-
bun add -D @tanstack/react-router-ssr-query
27+
bun add @tanstack/react-router-ssr-query
2828
```
2929

3030
## Setup
@@ -38,7 +38,7 @@ import { createRouter } from '@tanstack/react-router'
3838
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
3939
import { routeTree } from './routeTree.gen'
4040

41-
export function createAppRouter() {
41+
export function getRouter() {
4242
const queryClient = new QueryClient()
4343
const router = createRouter({
4444
routeTree,

docs/start/framework/react/authentication.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { redirect } from '@tanstack/react-router'
4747

4848
// Login server function
4949
export const loginFn = createServerFn({ method: 'POST' })
50-
.validator((data: { email: string; password: string }) => data)
50+
.inputValidator((data: { email: string; password: string }) => data)
5151
.handler(async ({ data }) => {
5252
// Verify credentials (replace with your auth logic)
5353
const user = await authenticateUser(data.email, data.password)
@@ -218,7 +218,9 @@ import { createServerFn } from '@tanstack/react-start'
218218

219219
// User registration
220220
export const registerFn = createServerFn({ method: 'POST' })
221-
.validator((data: { email: string; password: string; name: string }) => data)
221+
.inputValidator(
222+
(data: { email: string; password: string; name: string }) => data,
223+
)
222224
.handler(async ({ data }) => {
223225
// Check if user exists
224226
const existingUser = await getUserByEmail(data.email)
@@ -300,7 +302,7 @@ export const authProviders = {
300302
}
301303

302304
export const initiateOAuthFn = createServerFn({ method: 'POST' })
303-
.validator((data: { provider: 'google' | 'github' }) => data)
305+
.inputValidator((data: { provider: 'google' | 'github' }) => data)
304306
.handler(async ({ data }) => {
305307
const provider = authProviders[data.provider]
306308
const state = generateRandomState()
@@ -321,7 +323,7 @@ export const initiateOAuthFn = createServerFn({ method: 'POST' })
321323
```tsx
322324
// Password reset request
323325
export const requestPasswordResetFn = createServerFn({ method: 'POST' })
324-
.validator((data: { email: string }) => data)
326+
.inputValidator((data: { email: string }) => data)
325327
.handler(async ({ data }) => {
326328
const user = await getUserByEmail(data.email)
327329
if (!user) {
@@ -340,7 +342,7 @@ export const requestPasswordResetFn = createServerFn({ method: 'POST' })
340342

341343
// Password reset confirmation
342344
export const resetPasswordFn = createServerFn({ method: 'POST' })
343-
.validator((data: { token: string; newPassword: string }) => data)
345+
.inputValidator((data: { token: string; newPassword: string }) => data)
344346
.handler(async ({ data }) => {
345347
const resetToken = await getPasswordResetToken(data.token)
346348

@@ -421,7 +423,7 @@ const loginSchema = z.object({
421423
})
422424

423425
export const loginFn = createServerFn({ method: 'POST' })
424-
.validator((data) => loginSchema.parse(data))
426+
.inputValidator((data) => loginSchema.parse(data))
425427
.handler(async ({ data }) => {
426428
// data is now validated
427429
})
@@ -517,7 +519,7 @@ function LoginForm() {
517519

518520
```tsx
519521
export const loginFn = createServerFn({ method: 'POST' })
520-
.validator(
522+
.inputValidator(
521523
(data: { email: string; password: string; rememberMe?: boolean }) => data,
522524
)
523525
.handler(async ({ data }) => {

docs/start/framework/react/observability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Add logging to your server functions to track execution, performance, and errors
6161
import { createServerFn } from '@tanstack/react-start'
6262

6363
const getUser = createServerFn({ method: 'GET' })
64-
.validator((id: string) => id)
64+
.inputValidator((id: string) => id)
6565
.handler(async ({ data: id }) => {
6666
const startTime = Date.now()
6767

@@ -518,7 +518,7 @@ import { trace, SpanStatusCode } from '@opentelemetry/api'
518518
const tracer = trace.getTracer('tanstack-start')
519519

520520
const getUserWithTracing = createServerFn({ method: 'GET' })
521-
.validator((id: string) => id)
521+
.inputValidator((id: string) => id)
522522
.handler(async ({ data: id }) => {
523523
return tracer.startActiveSpan('get-user', async (span) => {
524524
span.setAttributes({

packages/react-start/src/default-entry/server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import {
22
createStartHandler,
33
defaultStreamHandler,
44
} from '@tanstack/react-start/server'
5-
import type { Register } from '@tanstack/react-start'
5+
import type { Register } from '@tanstack/react-router'
66
import type { RequestHandler } from '@tanstack/react-start/server'
77

88
const fetch = createStartHandler(defaultStreamHandler)
99

1010
export default {
1111
// Providing `RequestHandler` from `@tanstack/react-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`
12-
1312
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
1413
fetch: fetch as RequestHandler<Register>,
1514
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default {}
1+
export const startInstance = undefined

packages/react-start/vite.config.server-entry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default tanstackViteConfig({
44
srcDir: './src/default-entry',
55
exclude: ['./src/default-entry/client.tsx'],
66
entry: ['./src/default-entry/server.ts'],
7-
externalDeps: ['@tanstack/react-start/server', '#tanstack-start-entry'],
7+
externalDeps: ['@tanstack/react-start/server'],
88
outDir: './dist/default-entry',
99
cjs: false,
1010
})

packages/router-plugin/src/core/code-splitter/compilers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function compileCodeSplitReferenceRoute(
169169
(prop) => {
170170
if (t.isObjectProperty(prop)) {
171171
if (t.isIdentifier(prop.key)) {
172-
if (opts.deleteNodes?.has(prop.key.name as any)) {
172+
if (opts.deleteNodes!.has(prop.key.name as any)) {
173173
return false
174174
}
175175
}

packages/router-plugin/src/core/router-code-splitter-plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ export const unpluginRouterCodeSplitterFactory: UnpluginFactory<
131131
targetFramework: userConfig.target,
132132
filename: id,
133133
id,
134-
deleteNodes: new Set(userConfig.codeSplittingOptions?.deleteNodes),
134+
deleteNodes: userConfig.codeSplittingOptions?.deleteNodes
135+
? new Set(userConfig.codeSplittingOptions.deleteNodes)
136+
: undefined,
135137
addHmr:
136138
(userConfig.codeSplittingOptions?.addHmr ?? true) && !isProduction,
137139
})

packages/solid-start/src/default-entry/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ const fetch = createStartHandler(defaultStreamHandler)
99

1010
export default {
1111
// Providing `RequestHandler` from `@tanstack/solid-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`
12-
12+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
1313
fetch: fetch as RequestHandler<Register>,
1414
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default {}
1+
export const startInstance = undefined

0 commit comments

Comments
 (0)