* Replace deprecated createServerFn().inputValidator() with .validator() * Add CSRF middleware for server functions * Fix prettier formatting after validator rename * Pass Zod schemas directly to .validator() Drops the (data: unknown) => schema.parse(data) lambdas in favor of standard-schema support. This also makes server-fn callers type-checked against the schema input, which surfaced a dead hideSpam property in SearchTabStrip (the schema never included it and the server hard-codes hideSpam for web requests). * Name the inline project-scoped schema in projects.ts
12 lines
405 B
TypeScript
12 lines
405 B
TypeScript
import { createCsrfMiddleware, createStart } from "@tanstack/react-start";
|
|
import { globalServerFunctionMiddleware } from "@/serverFunctions/middleware";
|
|
|
|
const csrfMiddleware = createCsrfMiddleware({
|
|
filter: (ctx) => ctx.handlerType === "serverFn",
|
|
});
|
|
|
|
export const startInstance = createStart(() => ({
|
|
requestMiddleware: [csrfMiddleware],
|
|
functionMiddleware: globalServerFunctionMiddleware,
|
|
}));
|