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

extended-salmon
extended-salmon5/12/2025

Tanstack router loader vs. tanstack query

I am trying to data fetch in tanstack router. when i fetch with router loader with queryClient.ensureQueryData(jobsQueryOptions()) it works but when i filter via input it reload and i lose focus of input again i have to focus to type anther word, BUT when i do same with just tanstack query directly inside component it doesn't have that problem.
No description
foreign-sapphire
foreign-sapphire5/12/2025

Tab layout transitions

Hi, I'm making a mobile app and use tanstack router for navigation (react.js + capacitor). The base navigation is some tabs at bottom of the screen (like spotify for ex). I made slide-right and slide-left transitions, but I would like to do an animation based on the current page. Like, I have 4 pages, I'm on page 2, if I go on Page 1 i want a slide-left animation, if I go on Page 3, i want a slide-right animation....
deep-jade
deep-jade5/12/2025

Is it possible to keepPreviousData when using a deferred loader?

I have a case where I'm using a deferred loader, but I want to hang on to the previous data and render a loading overlay on top of my already-rendered page instead of wiping it out completely. I've searched the docs and couldn't find anything that made this seem possible.
fair-rose
fair-rose5/11/2025

TanStack router crashses when seeing a .glsl file

Hi I'm doing some stuff with .zarr files and geospatial data. I'm loading a package from: https://github.com/carderne/zarr-gl/tree/main, but it seems somewhere between rollup and tanstack something goes wrong. At runtime I'm getting some crash and information in my browser:
Private field '#version' must be declared in an enclosing class
Private field '#version' must be declared in an enclosing class
...
optimistic-gold
optimistic-gold5/11/2025

File Route Component Best Practices

Hello, I would like to ask if there are any best practices with regard to File Routes/Components Should a route file be a dumb wrapper around a component? Should the route file reference a separate component? If not, should the component inside the route file be named RouteComponenet, or a name similar to the route?...
xenophobic-harlequin
xenophobic-harlequin5/10/2025

Is this use of FileRouteTypes['to'] valid?

Hello, I'm using a Link component and the to prop is dynamic. I get the value of the to prop by calling my getConfigureModeLink function. To ensure the function can only return a valid registered route I have typed it's return type as FileRouteTypes['to'] which is the interface exported from routeTree.gen.ts....
conscious-sapphire
conscious-sapphire5/10/2025

testing broken after update to 1.120.3

updating 1.115.2 -> 1.120.3 breaks the setup for unit tests described here error stack trace: ``` Warning: An update to Transitioner inside a test was not wrapped in act(...). │...
flat-fuchsia
flat-fuchsia5/9/2025

Tanstack router: Not a good experience so far.

My app is extremely simple and almost no code written. "@tanstack/react-router": "^1.114.3", "@tanstack/react-router-devtools": "^1.114.3", "typescript": "^5.7.2",...
No description
jolly-crimson
jolly-crimson5/9/2025

Is beforeLoad supposed to run in this situation?

Hi! In my __root.tsx file, I check a session against my auth server in beforeLoad so I can update the router context. In a sub route, if I go from /a to /b, is there a way to preserve the context without having to re-run the root beforeLoad hook? (or any parent beforeLoad hook really) For context, my issue is that currently it's very slow because it makes a ton of requests for every page change...
like-gold
like-gold5/8/2025

change url in address bar without navigating

Hi, I was wondering if there is any way to just change the url in the browser's address bar. No routing, no rerenders. I tired to manually call
window.history.replaceState(null, "", newUrl)
window.history.replaceState(null, "", newUrl)
...
extended-salmon
extended-salmon5/8/2025

Tanstack router for protected route

Hi can someone help me quickly on this problem. I'm trying to implement protected route but I can't do the structure like the image. Do i have to use flat file routing ?
No description
exotic-emerald
exotic-emerald5/7/2025

SuperTokens integration with Router

Hi! I am looking for a good example of SuperTokens integration with Tanstack Router / Tanstack Start. Anyone have a working example, or could point me in the right direction?
like-gold
like-gold5/7/2025

Setting global search params

Hi, so I have this setup ``` export const rootRoute = createRootRoute({ component: Root,...
fair-rose
fair-rose5/6/2025

bad setState

I use tanstack query in next.js app router. When I use useSuspenseQuery I get this error Cannot update a component while rendering a difference component...
dependent-tan
dependent-tan5/6/2025

Caching a data loader's output with staleTime not working

I'm new to Tanstack Router/Start and am looking to implement standard ISR/stale while revalidate behaviour: 1) Data gets a bundled at build time 2) Cached data is served without the fetch functions being invoked for 30 minutes (staleTime) 3) When the staleTime is hit, serve cache data one more time, rebuild cache under the hood for the next request...
united-yellow
united-yellow5/6/2025

How to achieve type safety in this scenario?

I have the following routes: /route/$id/tab1 /route/$id/tab2 /route/$id/tab3 ...
wise-white
wise-white5/5/2025

Directory Structure Best Practice

Which one makes more sense? Why? 1. Combined: where you put each features extra directories like components and services inside the routes directory. 2. Separated: where you put each features extra directories inside a shared component or feature directory....
No description
foreign-sapphire
foreign-sapphire5/5/2025

Layout only files

Hey guys, here is my test of files/folders structure for my auth part. My goal is to have: - /login (login page) - /active/{generate/check/post} - /password/{generate/check/reset}...
No description
optimistic-gold
optimistic-gold5/5/2025

useNavigate to change search params without remounting the route componen

I'm trying to use useNavigate() to change just the search params, but it unnecessarily flashes due to unmounting and mounting the route component again. Is there a mode of operation where it "just" updates the URl with history push but doesn't re-mount the Route component? My code: ```typescript...
optimistic-gold
optimistic-gold5/5/2025

i18n Routing - Question

Hello I would like to add i18n support to my TanStack Start app I was hoping to support website.com/my/path (english)...