TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

📣-announcements

rare-sapphire
rare-sapphire10/5/2025

Using zod to parse environment

In the docs there is a runtime validation example in https://tanstack.com/start/latest/docs/framework/react/environment-variables#runtime-validation ``` // src/config/env.ts import { z } from 'zod'...
adverse-sapphire
adverse-sapphire10/5/2025

Issues with server routes

In Server Routes there are two examples that aren't working: - const { _splat } = params -> _splat is undefined and i get typescript errors on that declaration. - setResponseStatus is not woring at all...
harsh-harlequin
harsh-harlequin10/5/2025

I am getting this error in my tanstack start + nitro v2 deployment on vercel

[error] [nitro] RollupError: server.js (6:18): "toResponse" is not exported by "node_modules/h3/dist/index.mjs", imported by "server.js".
modern-teal
modern-teal10/5/2025

Error reading routerStream: Invalid state: Controller is already closed error

i keep getting this error, however it does not impact my application anyhow - has anyone experienced this error yet? Where should i search? code: 'ERR_INVALID_STATE' }...
extended-salmon
extended-salmon10/5/2025

Query client in loader

The docs say that if you want more control over caching and garbage collecting, we need to use TenStack Query client in loader. But further in documentation it says that TenStack Query client is created on every page request (on the server side) so users get their own data. How can I use the shared caching/deduping between routes ?...
No description
equal-aqua
equal-aqua10/5/2025

How to handle client preferences?

I’m currently looking at migrating from React Router to TanStack Start and trying to identify equivalent solutions to problems I’ve run into. Is there a solution for handling client-side preferences like browser language, timezone, and theme? I have a document describing this problem in more detail here: https://github.com/wrporter/starter-monorepo/blob/main/.github/decisions/7-client-preference-cookies.md...
other-emerald
other-emerald10/4/2025

Run code before SSR and CSR in RC

I'm upgrading to RC from 1.120. Prior RC, I had i18n setup with lingui similar to https://github.com/lingui/js-lingui/tree/main/examples/tanstack-start ```ts...
adverse-sapphire
adverse-sapphire10/3/2025

No error upon defining conflicting routes

Why this does not trigger any errors: ``` export const Route = createFileRoute('/server-routes')({ server: { handlers: {...
adverse-sapphire
adverse-sapphire10/3/2025

Environment variables best practices

In one example here (https://tanstack.com/start/latest/docs/framework/react/execution-model), I noticed a code snipped saying to use createServerOnlyFn to return an environment variable so that it's not accidentally leaked to the client. However, in another section (https://tanstack.com/start/latest/docs/framework/react/environment-variables) it says that env variables aren't even accessible in client code unless the name is prefixed with VITE_. I'm struggling to understand in which circumstance each solution is supposed to be used, as from my understanding they both result in the same end functionality of the variable being withheld from the client bundle. Can anyone shed some light on this and help me understand the specific cases in which one approach should be preffered? Thanks!...
unwilling-turquoise
unwilling-turquoise10/3/2025

Delay Loading Page on Vercel

This isn't something I notice when I'm running in development mode. But when we deploy to Vercel, the first time we load the app, or any time we try to refresh (so I guess any time it goes to the server for a route), we get a 10 second delay before everything rushes in. I'm struggling to debug it because I don't really get any logs. I've got a suspicion it could be to do with Clerk because there is a route that is not authenticated, and I don't think it's having the same issue, but it also doesn't do a lot. There's nothing in the browser recording of the requests because it's all in the single request to that route, not in any of the server function calls. the browser just sort of sits on a white page for 10 seconds and then everything rushes in as it does the extra calls. Has anyone experienced anything like this or have any sort of suggestions on where I could start to look?...
genetic-orange
genetic-orange10/3/2025

Server Routes / Functions not working properly

Hi, I'm having an issue with using serverOnly() and createServerFileRoute. I've been using them for awhile in my codebase, but suddently after updating, errors are being thrown at me saying serverOnly doesn't exist, or createServerFileRoute doesn't exist. This worked error free not even 2 days ago, but now I can't get it to even spin up in a dev environment because all my server API routes are using that (I'm using the tanstack starter template with better auth / vite). Also getting a ton of route piece errors for ALL api routes, but never got them before. New to ts development so not sure what I'm doing wrong. I asked chatgpt but it said to define my routes with GET POST or something like that, but i alredy have, for example ...
conscious-sapphire
conscious-sapphire10/3/2025

Cannot make react context work during SSR

I made a simple ThemeContext, I have a providers file which is loading all the providers. ``` function RootDocument({ children }: { children: ReactNode }) { return (...
eastern-cyan
eastern-cyan10/3/2025

Build & Preview 404

run into a 404 at the preview mode. defined the app as SPA. spa: { enabled: true } Cannot GET / can anyone support me?...
absent-sapphire
absent-sapphire10/3/2025

Server function middleware's aren't receiving the request object

Could someone help me out here, think I might be missing something obvious. I would expect this middleware to log out the request object so it can be used for authentication etc. ``` import { createMiddleware, createServerFn } from '@tanstack/react-start'; ...
extended-salmon
extended-salmon10/3/2025

type broken on useServerFn?

Sorry for the AI generated summary, but just wanted a clean reproducible version of the issue: ```import { useMutation } from "@tanstack/react-query"; import { useServerFn } from "@tanstack/react-start"; ...
like-gold
like-gold10/3/2025

SSR environment is not ready

What is the reason for this error after deployment? SSR environment is not ready
absent-sapphire
absent-sapphire10/2/2025

Claude Code can't run tanstack start in it's bash

Is this happening to anyone else? If I have claude code run localhost it just ends closes the bash instantly. I'm using tanstack db electric collections in case that's flagging claude code for some reason and it's killing it. But anyone else have this issue right now?...
foreign-sapphire
foreign-sapphire10/2/2025

How to throw a error in a middleware and catch it on parent middleware

I have 2 middleware like the image, but A middleware is not catching anything and the Error is sending to client but it fails because a class is not serializable g [Error]: The value [object Object] of type "object" cannot be parsed/serialized....
No description
xenial-black
xenial-black10/2/2025

How to access nonce in Middleware?

How can we access the nonce introduced in https://github.com/TanStack/router/pull/5287 in Middleware .server context, so that we can properly set the CSP header?