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

adverse-sapphire
adverse-sapphire2/6/2025

All child routes in a single bundle?

Is it possible to include all child routes code in a single bundle. The generated bundle files for child routes are very small in size.
national-gold
national-gold2/6/2025

running beforeLoad auth in __root.tsx, but which needs access to a Context

basically at the __root i want to run auth checks beforeLoad. in this auth check, however, i need to set context values that will be available to the rest of the app. in order to wire up context to be available in the beforeLoad, I need the <Provider/> to be wrapping the component, right? but we're at the top level which makes things difficult. one idea is to update the component property of the Route object to return ...
No description
jolly-crimson
jolly-crimson2/6/2025

Routing issues with better-auth

I've built a TanStack Start app based on better-auth's example and struggling with two issues: 1. something navigates to /auth/signin? (the '?' is actually tacked on) when better-auth's signin runs. I don't know what is doing the navigation nor why it appends a '?'. 2. TanStack's navigation doesn't work inside better-auth's signin onSuccess callback. I've tried router.navigate and useNavigation with and without router.invalidate() and router.invalidate({sync: true}) The call to better-auth's signin function looks like this:...
metropolitan-bronze
metropolitan-bronze2/6/2025

Need advice on authentication

https://stackblitz.com/~/github.com/RenZin12/test-tanstack-router Here is my authenticated routes. The username is "Bob" and password is "123". In my backend, I am using session authentication. I am still quite new to React and TanStack router so I am still confuse on how they all come together. ...
fair-rose
fair-rose2/5/2025

Conditionally loading route tree based on user type

Working on a Start project where I want to conditionally load a different route tree based on the user type. Is this possible?
stormy-gold
stormy-gold2/5/2025

virtual file route

How to get started with virtual file routes? is that possible to get route for this file(please avoid code-based) : src/modules/user/index.tsx...
stormy-gold
stormy-gold2/5/2025

How to retrieve "latest params" when loading a route?

Hello, I have a /meetings page that have multiple filters (search params) and the requirement is that every time user navigates to this page, these parameters are retrieved, and he sees what he saw before. What's the idiomatic way to do handle it with tanstack/router?
rare-sapphire
rare-sapphire2/5/2025

Unexpected Loader Re-Requests on Current Route Hover with Preload ‘intent’

Why does the loader get re-requested every time I hover over a <Link> for the current route when the preload value is set to 'intent'? Is this intended behavior? When hovering over a <Link> for a different route, the request is not made again within the preloadStaleTime duration. I believe it should behave the same way.
fair-rose
fair-rose2/4/2025

Change parent layout based on child route matching

Hi, I have a parent layout component and I need to render it a bit differently if a certain child route is active. I've tried to do useLoaderData({ from: "child route" }) but it throws if the child route is not matched. Is it recommended to un-nest from the parent routes and just render the layout in the child route? If I do that, I can't grab the parent loaded data which means I have to repeat the parent data loading in the child route, it's not a problem, but I just wanted to know if there's a better way. Cheers...
united-yellow
united-yellow2/4/2025

Where are beforeLoad and loader executed?

Does loader always run in the server, and beforeLoad always run in client and can access to client-side api? Where can I find the environments the functions are executed in? I’m coming from Next.js so I’m a little confused when it’s not explicitly written in
xenial-black
xenial-black2/4/2025

Why defaultPendingMs defaults to 1000ms?

Does anyone know if there is a good reason why such a high value was chosen for defaultPendingMs? If I would leave the default value and the loader needs e.g. 3000ms, the user sees no change for 1000ms after the link-click and only then comes to the route and the corresponding pending component. I'm just asking out of interest. thanks!...
wise-white
wise-white2/3/2025

File based nested routes not working as expected

I'm trying to load pages with dynamic routes. Here is my router structure. 1. _private->projects->$projectId 2. _private->projects->$projectId->cards->$cardId...
deep-jade
deep-jade2/2/2025

Getting current routeId

I'm sure I'm missing something, but reading through the docs and testing things, I cannot figure out how to get the current routeId within a component (and to have that value reactive / re-render the component). Can anybody point me in the right direction?...
like-gold
like-gold2/2/2025

App unmounts on page navigation

With Auth Provider when doing page navigation with createRootRouteWithContext seems like <Outlet /> gets remounted each time. I hit this issue with Convex Auth, so I tried to write my own Provider with Supabase and noticed same issue. It results in disappearance of shared components like <AppSidebar /> and re-checking auth each time page navigation happens. _authed.tsx: ```tsx...
fair-rose
fair-rose2/1/2025

`beforeLoad` not called for pathless route

Hi, I have a pathless route called _authenticated.tsx with a beforeLoad function but it's never called. Is this by design or may it be a bug? Child routes' beforeLoad of this pathless route is called, so I'm sure I'm not throwing something in the pathless parent beforeLoad.
deep-jade
deep-jade2/1/2025

Run callback when someone exit the page

Hey, Is there a way to run callback when someone leave the page?...
genetic-orange
genetic-orange2/1/2025

How to read request object for a route?

Hello, I was wondering what is the correct approach for reading the request object for a route? In react router you would do something like: ``` import { LoaderFunctionArgs, redirect } from 'react-router'; import { parse } from 'cookie';...
unwilling-turquoise
unwilling-turquoise2/1/2025

Are there plans to support react 19?

I'm trying to migrate to react 19 and so far the single package that stops me is tanstack router. I'm getting "Cannot read properties of undefined (reading 'ReactCurrentOwner')". Without router there is no issue. Are there plans for support react 19 or maybe there is workaround for now? Thanks
absent-sapphire
absent-sapphire1/31/2025

Redirect routing to correct route from bun

I am using the new bun 1.2 to bundle my SPA and so far everything is working great! I only have a small issue which I am sure as been addressed before but I couldn't find. Basically with the new bun 1.2 it allows you bundle the app without the need of vite here's the code ``` import app from "./public/app.html"; Bun.serve({...