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

other-emerald
other-emerald8/12/2025

cookie issue in production

I'm using the below code after setting up ssr in my root page so i thought of validating the session of the user in the server side only, I'm using the following code below for the session fetching which I am calling from beforeload function of __root.tsx file, it works totally fine on localhost but when i pushed it to prod it doesn't work, I guess the issue happened as both backend and frontend are deployed on different addresses. Before ssr everything works fine . Here's the sample of my code. ``` import { createServerFn } from "@tanstack/react-start"; import { getHeaders } from "@tanstack/react-start/server"; import { authClient } from "./auth";...
deep-jade
deep-jade8/12/2025

Deduping function calls on the server?

Is there any method for deduping calls on the server? I have a getSession function that I'm calling in several serverFns in the same SSR pass, and I'd like it to be invoked only once. I tried to create a cache on the request, i.e. sessionCache.get(getWebRequest()), but seems like the returned request does not have a stable identity. Is there anything else unique to cache by that will hold across a whole SSR pass?...
sensitive-blue
sensitive-blue8/11/2025

how do you build tanstack start for aws-lambda?

With vinxi, there was a preset: 'aws-lambda' property, but now that im using vite im not sure how to configure this.
flat-fuchsia
flat-fuchsia8/10/2025

"createRouter is not a function" after updating to `@tanstack/react-router-ssr-query`

Here is my router.tsx file ``` import { QueryClient } from "@tanstack/react-query"; import { createRouter } from "@tanstack/react-router"; import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";...
dependent-tan
dependent-tan8/9/2025

hot module reload not working?

could you please help me understand why hmr is not working? I couldn't figure it out. https://github.com/Cuhadari-Deniz/t-start-mono i thought it had todo with the site being statically rendered so i tried ssr: false but had no luck. And in the html source code i can see global hooks that are looking like they are there for the hot module reload ... but nothing gets updated. ...
foreign-sapphire
foreign-sapphire8/9/2025

How to add custom unenv polyfills for cloudflare-module

I struggle using @aws-sdk/client-s3 with cloudflare-module preset. I keep getting the error Error: [unenv] fs.readFile is not implemented yet! at runtime, when I try to upload to/download from an S3 bucket or pre-sign URLs. Does anyone have similar issues when deploying to Cloudflare? Or now how I can add custom polyfills (unenv/node/fs in my case) on top of the default ones? I already tried the following: * Switching from cloudflare-module to cloudflare-pages following the TanStack Start docs for React (I'm using SolidJs)...
xenogeneic-maroon
xenogeneic-maroon8/9/2025

How do I stop server code getting leaked to the client?

Hi, I have an util that should only be used by server code in orpc that leverages the crypto module, but based on my browser logs I am getting errors such as: ``` Uncaught (in promise) Error: Module "crypto" has been externalized for browser compatibility. Cannot access "crypto.createCipheriv" in client code --- Uncaught (in promise) ReferenceError: Buffer is not defined...
rising-crimson
rising-crimson8/9/2025

How to Dynamically Update the Page Title After Rendering

How can I dynamically update the <title> tag after the page has been rendered? I am currently using the following code to render the title for pages: ```ts...
foreign-sapphire
foreign-sapphire8/8/2025

Is React 19 supported?

Is React 19 supported in Tanstack Start?
afraid-scarlet
afraid-scarlet8/8/2025

[ERR_MODULE_NOT_FOUND]: Cannot find module ... `esm` ... Did you mean to import ... `cjs` ...?

Hey all! First time poster here. Wish I didn't hvae to... I've been trying to deploy my TanStack Router SSR app to Netlify for the last couple days and I'm starting to lose hope. I thought something like that would be a breeze in 2025 but it looks like it's still a mess. So many yet so few pages documenting what needs to be done and all showing something different. Briefly looked at the TanStack Start page but seeing how it's a "framework" I ignored it... until today when I realised that it's not really a framework but just Router with a bunch of build tools on top of it. So I installed it and finally managed to get my project to build and deploy to Netlify but now it keeps throwing the following error in the function logs:...
conscious-sapphire
conscious-sapphire8/8/2025

Content flash with useOptimistic and router.invalidate

I'm trying to use useOptimistic to optimistically update some data. But when I call router.invalidate() (once the data has successfully been persisted), there is a brief flash. Minimal example in the thread....
stormy-gold
stormy-gold8/8/2025

Is installing Vite as a `dependencies` intentional?

As the title says, for context, I'm following the build-from-scratch guide and saw this (see image).
No description
xenial-black
xenial-black8/7/2025

Incremental Adoption Remix -> Tanstack

I've got a project at work that I think would benefit from Tanstack Start a ton... But I don't know of a way to split things up so that way it can be incrementally adopted. Because of vite constraints, is this something that even can be incrementally adopted? Or do you kind of have to dump everything over at once?
afraid-scarlet
afraid-scarlet8/7/2025

createServerFn POST vs GET

It seems like the docs don't specify when to use POST vs GET for a server function as you can technically write whatever logic you want inside and it gets serialized automagically using either. Wanted to know if there's any specific guidance here other than just using your best judgement to determine whether it should be GET vs POST? Also why is it limited to just GET and POST only?...
other-emerald
other-emerald8/7/2025

Centralized error handling

Hiii everyone, I am working on a huge educational project and we have a start frontend where the majority of serverFn's simply call another API We haven't figured out yet how to handle errors in a centralized manner, and this is forcing us to do a nasty try...catch everywhere, it is verbose and IMO unecessary, but we haven't found a better way yet Example of how we are handling errors, in this case the analytics api is external to the frontend....
optimistic-gold
optimistic-gold8/7/2025

How to check if a server function has a certain middleware

Say i have a middleware ```js export const requireAuthMiddleware = createMiddleware({ type: "function", }).server(async ({ next }) => {...});...
flat-fuchsia
flat-fuchsia8/7/2025

How to handle environment variables

I cant seem to find any documentation on environment variables. Are there any recommended ways of doing this? As of now i am currently using "@t3-oss/env-core" with env-client.ts and env-server.ts, however i feel like Start / Router / Vite offer a better solution for this. Anyone knows?...
other-emerald
other-emerald8/6/2025

router.invalidate() and auth history navigation

Hi all! I was trying out some auth patterns and came across this situation where: 1. A user is signed in at /dashboard 2. The user navigates to / 3. The user signs out 4. The user history navigates back to /dashboard...
ratty-blush
ratty-blush8/6/2025

Localised routing? e.g. /en/pricing + /pl/cennik -> should be handled by single file of pricing.tsx

(Paraglide) How to handle this? I am almost sure I've seen some docs few days ago about it, but spent over an hour looking for it now and cannot git it out. I have quite few languages so creating dummy files to handle each page in each lang is completely no-go because it will be unmaintainable. How to approach it? ...
afraid-scarlet
afraid-scarlet8/6/2025

Basic HTTP Authentication

I am trying to implement basic HTTP authentication on an /admin route. The middleware section of the docs is a bit confusing as I'm not totally sure how I can specify a middleware to run before on a specific route everytime? I tried using the beforeLoad method, but it's a bit unclear if I have to create a middleware, wrap it in a server function, and then call it in my beforeLoad or if there's a simpler way to do this?...