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

foreign-sapphire
foreign-sapphire8/26/2025

CSRF Protection

I'm building an app with Tanstack start + Supabase and thought I'd ask Cursor to do a security audit and it gave CSRF protection ad a critical security issue.
Is there an elegant way of adding CSRF protection into my mutation routes? Or does Tanstack start have a nice built-in way to handle CSRF? Here's an example of how most mutations are created in my app...
absent-sapphire
absent-sapphire8/25/2025

@tanstack/solid-query with tanstack start + ssr

i did not find any equivilant to the @tanstack/react-router-ssr-query package for Solid. how else could i do this as i have gotten stuck thanks in advance and please ping when you reply...
extended-salmon
extended-salmon8/24/2025

No redirection using throw redirect in middleware

Hello, there is something I don't understand, below is my setup, why the redirect does not work ?? I just get an error on my ErrorCatchBoundary. It is like the error is not handled by the router lifecycle, but I don't understand why.... ```typescript // My dashboard route...
foreign-sapphire
foreign-sapphire8/24/2025

Is Tanstack Start good for apps not using tanstack router?

Hi. This is a highly opinionated question but it's be nice to reflect with someone on this Some websites may get all of their routing through a CMS, and my understanding is that to make it work in tanstack start you need to use a catchall/slug route (For example of a CMS https://docs.developers.optimizely.com/content-management-system/v11.0.0-cms/docs/content-tree-and-routing) ...
afraid-scarlet
afraid-scarlet8/24/2025

slow hmr

Anyone experiencing slow hmr with tanstack start? I am using content collections to drive content on my website, (content-collections/vite package). I'm wondering if that might be causing the issue.
flat-fuchsia
flat-fuchsia8/24/2025

react-native support?

was curious if anyone had a thought towards sharing router, and server actions in a react-native build as well? in my searching found it really interesting watching the intro video's for https://onestack.dev/ which look to be working towards doing this and vite builds for web and react-native with a heap of different render modes per route. ...
extended-salmon
extended-salmon8/23/2025

How to remove a client-specific thing from server bundle

I have say a chat app, and want to remove Markdown entirely from my server bundle since it is 1MB+ of JS (react markdown, syntax highlighters, katex, so on) which is polluting my server bundle when absolutely no markdown is actually rendered in SSR... I tried using React.lazy(), but this still includes them in the server bundle output (I'm using cloudflare-module output format)...
wise-white
wise-white8/22/2025

Throw `json` in middleware not working for route rendered on server

I have a basic role check in server middleware. In the loaderData function of a Route, it makes a call to a server function using that middleware. However, the server crashes when the route attempts to be loaded by a server without the required role. Any reason why this would be? My middleware: ```TS...
optimistic-gold
optimistic-gold8/22/2025

Invalidate QueryClient server cache

I’m using TanStack Query inside TanStack Start, and I’ve set the staleTime to 5 minutes. When I perform a mutation, I invalidate the related queries, which works fine on the client side. However, when I reload the page, the server still serves the old cached query data. This causes outdated information to be shown, even though the client cache has been correctly updated.
equal-aqua
equal-aqua8/22/2025

server-only isolation strategies (vite-env-only, `import 'server-only'`, etc.)

Hello! I wonder what strategies people adopt here to make sure no server-side code is leaking to their client budle or ssr outputs. I tried using import 'server-only' + vite-env-only blocking server-only, but that seems to create false positives when you use createServerFn....
fascinating-indigo
fascinating-indigo8/21/2025

Not encoded param in url cause SSR error when reloading

When reloading a page when the URL has a special value (ex: ê), and has a <Link /> component linked to the path with the param, it results in an error. see : https://github.com/olivier-deschenes/tanstack-start-not-encoded-uri-ssr-bug for demo ...
No description
conscious-sapphire
conscious-sapphire8/21/2025

Need Help! Child Dynamic Route Loader affects Parent Route Query?

I've the following setup: Using Supabase for auth/db stuff, i have defined both a client and a server instance in __root.tsx I call supabase auth getUser and getSession, pass it down to the component which uses useEffect to pass the session to the supabase client instance _protected.tsx beforeLoad checks if getUser() returns a user, redirects to /login otherwise /_protected/leads/index.tsx renders a table of leads, using a hook within the component that returns a useQuery which calls supabase (client instance) gets leads returns data...
optimistic-gold
optimistic-gold8/20/2025

What compiler Tanstack Start uses under the hood?

Hey, based on my shallow research, it seems that it uses vite-plugin/react, which uses babel under the hood. Babel is very slow AFAIK. Why use that and not the react-swc plugin instead, if you don't have any special babel plugins in the pipeline, it seems. react-router v7 uses babel for sure as they have some of the internal plugins I think, which is super sad, but for Tanstack I haven't see direct use of the babel capabilities, so react-swc might be good enough to be just drop in replacement with a boost in performance? In case you still see great performance and better build performance than Next.js, then I'm fine with Babel, but I'm not sure it will be as good when Turbopack is fully GA for both dev and production builds. I'm surprised SWC isn't a default thing here....
complex-teal
complex-teal8/20/2025

OpenTelemetry SDK Setup Issue with TanStack Start

I'm trying to set up OpenTelemetry in my TanStack Start project but running into build errors. My Setup - TanStack Start with cloudflare-module target - Installed @opentelemetry/sdk-node...
exotic-emerald
exotic-emerald8/20/2025

ClientOnly not working, error still raised on server side

Hey! I have some code which I want to only run on the client side (100ms live - https://www.npmjs.com/package/@100mslive/react-sdk). I am currently getting this error on the server: ...
sensitive-blue
sensitive-blue8/20/2025

Sentry setup with start?

Reading so many mixed/outdated templates on how to setup Sentry, anyone has some doc/repo to share?
stormy-gold
stormy-gold8/20/2025

Unit testing with Tanstack Start

Hey guys, I can't find any info on this so hoping someone here can help. I want to put unit tests in place for some of my server functions and middleware but I haven't been able to figure out how to call the relevant handlers. Currently the only way I can tests the handler logic is to split it out from the server function definition (i.e. export a function and supply to the .handler / .server methods) but this feels like overkill and I'm not sure I want to expose functions just for the sake of testing discrete parts of the flow - doesn't feel right....
flat-fuchsia
flat-fuchsia8/20/2025

dynamic middleware generation???

I did reach out to Tanner on twitter regarding this as well here but does anyone know if we can generate middleware dynamicaly on the fly? or must it be generated statically so bundled at build time. this as an example would be a dynamic middleware generator that checks user has the correct permissions in screenshot. if can't be done I'll just do as a utility function at top of handler but this would be nice if can do....
No description
optimistic-gold
optimistic-gold8/19/2025

How to be assured environment variables secrets sensitive data are not being leaked?

Coming from nextjs, the server-only package seems to be separate from nextjs, but using it with tanstack start does not seem like I'm using it correctly. Basically setting in any file that references an environment variable or business logic. I removed all implementations and did a test with a single secret file being imported into a createServerFileRoute file, and the whole client app crashes complaining about not using it in client code, but it is not being used in client code. I go...
Next