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

exotic-emerald
exotic-emerald2/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
quickest-silver
quickest-silver2/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!...
stormy-gold
stormy-gold2/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...
absent-sapphire
absent-sapphire2/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?...
ratty-blush
ratty-blush2/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...
mere-teal
mere-teal2/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.
unwilling-turquoise
unwilling-turquoise2/1/2025

Run callback when someone exit the page

Hey, Is there a way to run callback when someone leave the page?...
absent-sapphire
absent-sapphire2/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';...
other-emerald
other-emerald2/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
continuing-cyan
continuing-cyan1/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({...
eastern-cyan
eastern-cyan1/31/2025

Where search validation happens?

I have many cards when I click on it it gets highlighted. The logic is simple, I get the selected id from hook route.useSearch. I use useNavigate().navigate() to set the active id The problem is when I set the internet to slow on dev tools the cards take a lot of time to get highlighted. ...
genetic-orange
genetic-orange1/31/2025

How to refetch/invalidate router data?

I want to revalidate router data after an API change, There is any way I can easily force the router loader to refetch the data and the child components to updated using the useRouterData?
stormy-gold
stormy-gold1/30/2025

Help! 30 seconds to first paint

I must be doing something upside down and inside out. When loading fresh (no local cache, etc.), my app can take up to 30s before it's actually rendered. Instrumenting the performance hasn't revealed anything obvious. In fact, some of the time the browser reports that the initial frame renders in <1s although nothing is visible until 20-30seconds later. Any tips on how to investigate and debug this would be super helpful! Here's an example of a typical route in my app:...
eager-peach
eager-peach1/29/2025

"Error: Invariant failed: Could not find match for from: /posts" + "Error preloading route! ☝"

Hey! Whenever I simulate different viewport in the browser, I'm getting warnings with errors in the title whenever I go into /post/$postId route from /posts while the fetch with $postId is not yet finished. This warning is not displayed at all when I don't simulate the viewports. I've tested this on multiple viewports but the warning is displayed every time. Everything seems to be working just fine but I'm not sure if it's safe to ignore this warning or not. Here's the minimal reproduction link: https://stackblitz.com/edit/tanstack-router-ijhtsvaj?file=src%2Froutes%2Fposts_.%24postId.tsx. I've made minimal changes to posts_.$postId.tsx, and I've increased the sleep in postQueryOptions to 2000ms. You'll have to open the preview in new tab to see the console. I've also added a video showcasing the problem to make it simpler to understand 🫡...
No description
optimistic-gold
optimistic-gold1/29/2025

staticData on a lazy route

Hi, I want to make a breadcrumb component using useMatches and staticData on my routes. Everything is ok until I want to use lazy route with createLazyFileRoute which doesn't allow staticData to be passed. I would like to know if there's an alternative to using staticData to achieve what I want to do, or if I need to stay on non lazy routes....
manual-pink
manual-pink1/29/2025

[vite] Internal server error: [...]routeTree.gen.ts:28:1: ERROR: Expected identifier but found "/"

I am setting up a new vite-react project and intend to use tanstack-router. I have followed the Quick start instructions, but end up getting the following error when I run the development server. I have copied and named the files and directories as per the docs; __root.tsx, about.lazy.tsx, index.lazy.tsx, main.tsx....
fair-rose
fair-rose1/29/2025

can i have multiple Pathless Route Group Directories at the same level, each with a layout inside?

i'm looking to have the following structure ``` routes (auth)...
deep-jade
deep-jade1/29/2025

[iOS] Page swipe issues when beforeLoad runs an async fetch

On swipe back on iOS (safari), it would briefly flash the previous screen and then load the correct screen. This issue also exists on TS Start. Has anyone figured out a way to make this be less noticeable? I've looked across the internet and it seems to be a prevalent issue in client-side routing and iOS's "page preview" thing....
fair-rose
fair-rose1/29/2025

will the vite server generate the routeTree if I've deleted it

i've gotten into a weird state with customizing the config (and i'll probably continue to tweak it) and seem to have gotten my project into a tricky state do i need to manually create this file, or should it be autogenerating when i boot the dev server?...