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

correct-apricot
correct-apricot3/29/2025

Cannot read properties of undefined (reading 'config')

Whenever I'm navigating in the project I'm getting the error from the title. It seems to be caused by the beforeLoad from __root.tsx The code:...
grumpy-cyan
grumpy-cyan3/29/2025

Root loader staleTime behaviour

I have a server-function that returns the user theme (based on cookies) being called in my __root layout. This should only need to be fetched on the first load, so I thought I could set staleTime to some high value, but looking at the logs and network requests the server-function call is still being made on every navigation and pre-fetch. e.g.: ```tsx...
sunny-green
sunny-green3/29/2025

Deployment on Cloudflare Workers

The documentation currently only explain how to deploy on Cloudflare Pages. Is the any sort of guide for deploying to workers?
adverse-sapphire
adverse-sapphire3/29/2025

Passing formdata with file to server function but file disappears

Hi there I have a image uploader in my app that uses a hook to pass the data to a server function but when I try to pass the the formdata to the serverfunction, my function's validator tells me that the file is missing "Missing or invalid file". I am not sure what I am doing wrong: ```ts // snippet...
No description
absent-sapphire
absent-sapphire3/28/2025

Document Meta for Streaming SSR

Hey friends! I have a page where I’m returning a promise from the loader and handle it with <Await>, but that page’s meta depends on the promise data. I can’t use the promise in the “head” property of the route because it can’t be async. The Document Head Management page for Start tells me that it should be rendered in the <head> which is in the __root, but is it safe to be used...
genetic-orange
genetic-orange3/28/2025

Trying to do dependent prefetches

I was trying to run this in a start loader with query: ```ts loader: async ({ context: { getMovieFetchOptions, queryClient },...
quickest-silver
quickest-silver3/28/2025

beforeLoad error in createFileRoute gets handled differently depending on previous route

Hello, I had a bit of a hard time making the title clear enough. Based on where the user is coming from, if an error is thrown within a beforeLoad , the component rendered is different. You can use this deployment of the start-basic-auth example: https://tanstack-basic-auth-production.up.railway.app - note that I wasn't able to deploy it properly in any of the ide-in-the-browser options (the behavior is weirdly delayed by a few seconds) nor on netlify (I wasn't able to find a way to tell the platform to use npm run start for the start step). To reproduce the issue described, do the following: 1. Visit the root page of the app. Then, click on "Posts" to visit the /posts page. You'll see that this prompts the Login component because the beforeLoad gets triggered properly, and with a user that's not signed in, the errorComponent correctly handles the error message conditions and displays the Login form....
fair-rose
fair-rose3/27/2025

How to establish a mongo database connection

I want to connect to a mongo database, usually I put this at the entry point of the server, like so: ``` import mongoose from 'mongoose'; import { app } from './app.ts'; import { ENV } from './constants/config.ts';...
other-emerald
other-emerald3/27/2025

API routes vs Server Functions

I'm experimenting with Start in a new project and loving it so far. I'm looking for some guidance on API routes vs Server Functions. When would I choose one vs the other? Especially given the docs indicate that server functions will have configurable URLs in the future ...
firm-tan
firm-tan3/26/2025

What's the difference between a pathless route layout and a group route layout?

Hi everyone, what's the difference between a pathless route layout and a group route layout in file-based routing? I read through the docs but from my test they seem to be doing the same thing. Is there a key difference I'm missing?...
No description
firm-tan
firm-tan3/26/2025

How does URL rewrite work in Tanstack query?

I have updated my app.config.ts file with nitro config to rewrite / to /home app.config.ts ``` routeRules: {...
harsh-harlequin
harsh-harlequin3/26/2025

Unable to get JSON in Post API Route

I am doing the following in a POST API Routes handler: ```ts export const APIRoute = createAPIFileRoute("/api/test")({ POST: async ({ request }) => { const body = await request.json();...
deep-jade
deep-jade3/26/2025

Cannot read properties of undefined (reading 'result')

I kept getting this random error on my loader function so I changed it to a before load and I keep getting the exact same error. Its so weird because I can't even catch the bloody error. If I place a try catch over my entire fn it still throws. This is the entire error: ```bash TypeError: Cannot read properties of undefined (reading 'result')...
other-emerald
other-emerald3/25/2025

Error while building,

Hello, i followed the shadcn docs for tanstack start, in dev mode it works but when i run build i get following error: ``` 📦 Compiling ssr router......
foreign-sapphire
foreign-sapphire3/25/2025

Issues and questions regarding SSE in server function and API routes

Hi there! Context: I'm building a web turn based 1v1 game. Behind the scenes, the way it would work is playing a move sends a POST request, the server will mutate the game state in the DB, and propagates changes to ther other client with SSE. I'm using version 1.114.25 in my project. I've tried to use the example in the docs regarding streaming responses here: https://tanstack.com/start/latest/docs/framework/react/server-functions#returning-raw-response-objects, and using the EventSource API with a very simple useEffect for now:...
flat-fuchsia
flat-fuchsia3/25/2025

Authentication using React context/hooks

how do i adapt this https://tanstack.com/router/latest/docs/framework/react/guide/authenticated-routes#authentication-using-react-contexthooks to work with start, specifically with convex auth. i have changed _root.tsx and router.tsx but i have no App.tsx to modify and inject the context.
continuing-cyan
continuing-cyan3/25/2025

Setting cookies when you have a separate server that manages auth

I have a separate golang server and I am using tanstack-start. I have a verify otp route that sets a session cookie. I am calling this endpoint from a server function. Now in an ideal world, the cookie on my browser would automatically be set, but it does not get set. Does this have anything to do with server functions not having a stable public url? Server runs on localhost:8080, client runs on localhost:3000. ```ts export const serverVerifyOtp = createServerFn({ method: "POST" }) .validator((data: unknown): typeof VerifyOtpInput.infer => {...
extended-salmon
extended-salmon3/25/2025

Netlify deployment error cannot find module @rollup/rollup-linux-x64-gnu

Is anyone here facing the same problem I am getting when deploying to Netlify? vinxi v0.5.3 Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory....
conscious-sapphire
conscious-sapphire3/25/2025

No Routes Auto-Complete

I am new here but why is there no auto-complete for the existing routes? 🥹
No description
rare-sapphire
rare-sapphire3/25/2025

Global Persisting Cache

Hiya, really confused with how i would go about having global persisting cache with tanstack start and tanstack query? 1) I see the docs only mention persisting it stuff in localstorage.. but i would like to have a global cache like nextjs. 2) Even if i do localstorage.. i get errors that localstorage is not defined ...