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

flat-fuchsia
flat-fuchsia1/24/2025

Checking if there's scroll restoration

I have a case where I want to autofocus an input only if there's no scroll to restore (so that it doesn't jump to the top) - how do I register if there's a scroll restoration registered for the main window?
sunny-green
sunny-green1/23/2025

Route.useLoaderData() always resolves to ReadableStream<any>

v1.97.15 ```tsx // app/routes/index.tsx import * as fs from "node:fs";...
eastern-cyan
eastern-cyan1/23/2025

Using redis in registerGlobalMiddleware

Hello everyone, I don't know if I am using the registerGlobalMiddleware incorrectly but I cannot make redis work with it for some reason. With the very simple code below I keep getting the error attached. Has anyone else faced a similar issue with the registerGlobalMiddleware? Any guidance or suggestions would be greatly appreciated!...
No description
wise-white
wise-white1/22/2025

createServerFn with generic validators and return types

I'm using Start, and there are lots of 'boilerplate'-y code I would need to write for individual types. I created some builder functions to reduce this boilerplate, but I can't seem to get past this strange TS error in the handler() ``` Types of property 'records' are incompatible. Type 'T[]' is not assignable to type 'TransformerStringify<T, DefaultSerializable>[]'....
harsh-harlequin
harsh-harlequin1/22/2025

Can we change the preloading strategy in other parent routes?

Right now the preload config of a route is a boolean value. What if I want intent in other routes and viewport in other routes?
flat-fuchsia
flat-fuchsia1/21/2025

Sitemap

What's the preferred way to create a dynamic sitemap in TSS? Was thinking of an API route but it seems a bit quirky to get those to work from the root of the domain.
xenial-black
xenial-black1/21/2025

Is there a way to invalidate a query from a tanstack start server function

I'm using react query with tanstack start and I am redirecting from the server function straight but I need to invalidate the query I don't know if that is possible or I would need to stop redirecting from the server function completely
deep-jade
deep-jade1/20/2025

Type instantiation is excessively deep and possibly infinite

Hey there! I was testing https://conform.guide with the start-counter example and encountered this weird type error. Everything works perfectly at runtime. The repro is quite simple, just install conform:
npm i @conform-to/react @conform-to/zod zod
npm i @conform-to/react @conform-to/zod zod
and then in any page:...
No description
harsh-harlequin
harsh-harlequin1/20/2025

staleTime vs. preloadStaleTime

Hi. What's the difference between these to in terms of caching? I have a loader in my route component. If the preloadStaleTime is for the loader, what does staleTime affects?
harsh-harlequin
harsh-harlequin1/20/2025

Can we use tss' server function in useActionState?

If yes, should it be in useServerFn and pass the result to the useActionState or the ServerFn can already be passed in the useActionState?
national-gold
national-gold1/20/2025

What file should I be serving?

So I've just started tinkering with TanStack Start after years of working with React Router and NextJS and I'm trying to build a monorepo project that has a Go backend and TS Start frontend. Normally to do this with a SPA, you'd tell Go/Gin to serve a single file (often client/dist/index.html or something similar), but with how TS Start outputs, what file should I be serving from Gin? Any help appreciated here!
eastern-cyan
eastern-cyan1/17/2025

client only route loader?

I want to fetch data from indexdb and use ensureQueryData to ensure the page doesn't load until it exists, but i get an error because indexdb doesn't exist in the ssr environment. remix has a concept of a client loader, does start have something similar?
harsh-harlequin
harsh-harlequin1/17/2025

The console log of my home page runs both in the server and in the browser? Why is that?

Can anyone explain why and what is the purpose of it?
other-emerald
other-emerald1/17/2025

Flicker of the Previous Screen when swiping back on iOS Safari and iOS Chrome

Has anyone experienced anything like this and found a solution? I'm trying to find exactly where to look at at on tanstack.com's website repo since it doesn't happen on those pages. I apologize that I'm not able to create a repro at the moment but this behavior exists on other SSR frameworks like Remix/React Router. One of them has a video of what I'm experiencing: https://github.com/remix-run/react-router/issues/10883...
passive-yellow
passive-yellow1/17/2025

Has anyone experimented with React Native and Tanstack Start?

I know i can use tanstack router for web, expo for mobile, and a seperate backend but i saw this: https://x.com/tannerlinsley/status/1870697203699966283 and thought maybe tanstack start could be a better option....
ratty-blush
ratty-blush1/16/2025

Looking to replace NextJS for our multi tenant app

As the title suggests, we're looking to move away from NextJS on our multi tenant app. The primary use is we're allowing users to have sub domains. This is handled via our NextJS middleware with a config like this: ```tsx...
deep-jade
deep-jade1/16/2025

createIsomorphicFn on API routes for isomorphic cookies

Hey there! I created this abstraction for working with type-safe, isomorphic cookies. It works fine except on API routes where it fails due to the limitation of not being able to call server functions. I was wondering if there is an alternative design for my abstraction or if the team would reconsider the original limitation now that work is being done on that front 🙂 Thanks! Loving the framework so far. Very interesing ide...
passive-yellow
passive-yellow1/16/2025

error: createMiddleware must be called with a "use" property!, after updating from 1.95.7 -> 1.97.2

```6:32:35 PM [vite] Internal server error: createMiddleware must be called with a "use" property! Plugin: vite-plugin-tanstack-start-create-server-fn File: /Users/michaeldahl/Developer/Personal/dashboard/node_modules/.vinxi/cache/client/deps/chunk-5UEUQFZ2.js?v=7e4155f6 at Object.handleCreateMiddlewareCallExpression [as handleCallExpression] (file:///Users/michaeldahl/Developer/Personal/dashboard/node_modules/@tanstack/start-plugin/dist/esm/compilers.js:242:11) at file:///Users/michaeldahl/Developer/Personal/dashboard/node_modules/@tanstack/start-plugin/dist/esm/compilers.js:105:40...
sunny-green
sunny-green1/15/2025

Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the serv

Not happens on every site loading but I am just wondering how can I debug this error? I tried removing everything from the component in __root.tsx. As long as <Script /> is here, the error can happen. I know I don't provide a reproduction here but I am just looking for guesses if any or a way to have a clearer error message? 🙏...
harsh-harlequin
harsh-harlequin1/14/2025

Create API route at /sitemap.xml or /manifest.json

I'm trying to figure out how to create a handler that will response to /sitemap.xml or /manifest.json The difficulties I'm running in to are: - Wanting /api routes (no root, no layout, not html content-type) at a route other than /api - Wanting to include the . in the route itself - sitemap.xml.ts maps to /sitemap/xml in Tanstack file routing...