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-apricot1/4/2024

Is it possible to see routes history in devtools?

Imagine user change location from A to B to C. May I somehow track this history in devtools?
correct-apricot
correct-apricot1/3/2024

Path is not types safe

redirect fn doesn't produce any error if you pass path which is not in router with type string ``` const t: string = "bla"; ...
flat-fuchsia
flat-fuchsia1/3/2024

Tanstack Router: Get the current location/path

Is there any way to retrieve the current location of the router? to give an example of what I'm talking about, in react-router it was possible to use the useLocation hook to get the pathname of the router, is there the same thing or an alternative with tanstack?...
inland-turquoise
inland-turquoise1/3/2024

Posts refetch in example

In https://tanstack.com/router/v1/docs/examples/react/basic-react-query-file-based when switching from Posts page to Home page or Layouts page the ["posts"] query is not cached and gets refetched. Why? Posts instead are correctly cached. Thanks...
vicious-gold
vicious-gold1/2/2024

Form action not sending formData

```js export const LandingPage = () => { return ( <div className='flex flex-col items-center justify-center w-full h-screen m-auto...
flat-fuchsia
flat-fuchsia1/1/2024

[DevTools] Uncaught TypeError: contextMap[utilName] is not a function

Upgrading to 1.0.6 or beta-280 from beta-279 causes the following error when using inside of the RouterProvider ``` createHooksInternal-f1d4019d.mjs:146 Uncaught TypeError: contextMap[utilName] is not a function at createHooksInternal-f1d4019d.mjs:146:39...
adverse-sapphire
adverse-sapphire12/29/2023

Can you use TanStack Router without TypeScript?

I was assuming you could use this library without TypeScript, but after running the route generator I noticed TypeScript specific code in the output. If I'm not using TypeScript, should I be using this router?
optimistic-gold
optimistic-gold12/29/2023

Layout for Route

I there I'm new to tanstack router for react and I have the following set up: I have the following stricture: /profile /$organisation /$organisation/$project...
ambitious-aqua
ambitious-aqua12/29/2023

Bug or I am doing something wrong

I see the below error in console. I am not sure if this some bug or I am doing something wrong. Reproduction link: https://stackblitz.com/edit/github-mkmefb Uncaught Error: Invariant failed: Duplicate routes found with id: __root__...
fascinating-indigo
fascinating-indigo12/28/2023

beforeLoad never called when using with Webpack's FederationPlugin

I'm still trying to figure out issue, but it's haunting me for a while. I have a special routing library built on top of the Tanstack Router, and when I use the library directly it works pretty well – I have specific contexts defined in the beforeLoad, which are becoming part of the Route Context. However, when I start it in an environment with Webpack's FederationPlugin, the context is never collected as the beforeLoad is never ever called. Other issues aside, I cannot figure out the conditions where that could happen. I see that, hypothetically, there could be some silenced exception here: https://github.com/TanStack/router/blob/9d98af6659004e226970e6e49f7a756353e8f055/packages/react-router/src/router.ts#L1365, but I've tried to catch that – no luck....
flat-fuchsia
flat-fuchsia12/28/2023

Should I use tanstack router in a new project for production?

I need to make a project for a client, I will be using fastify, vite (react), tanstack query (with trpc), and for a router im not sure if I should use tanstack router (Which I would want to use), or react-router (that is much more mature). Now that tanstack router reached 1.0, would it be 'safe' to use for a production website?
wise-white
wise-white12/28/2023

tanstack router in nextjs

can i use tanstack router in nextjs app router and how?
equal-aqua
equal-aqua12/28/2023

route.useSomething() and eslint(react-hooks/rules-of-hooks)

is it ok to do this: ``` const route = new Route({ /* etc */ }); const { useLoaderData } = route; ...
absent-sapphire
absent-sapphire12/28/2023

queryClient.ensureQueryData(...) vs queryClient.fetchQuery(...) inside loader

Looking at https://tanstack.com/router/v1/docs/examples/react/kitchen-sink-react-query What's the reason for using queryClient.ensureQueryData(...) and then using useSuspenseQuery() over queryClient.fetchQuery(...) and returning the data in the loader, and then using router.useLoaderData() on the other end?...
quickest-silver
quickest-silver12/27/2023

HTML Text Fragments

First, to be clear on terminology. By "Text Fragments" I mean linking to a specific portion of a page. See: https://developer.mozilla.org/en-US/docs/Web/Text_fragments This is sometimes called "Anchoring." But that usually refers to something a little different. You can see this in action by going to the docoumentation and clicking on headers to see how it scrolls you to that specific section and adds the hash to the URL I didn't see any documentation about supporting this. Of course by support i mean just adding the #. The actual scrolling portion is handled by the browser. Should this sort of thing be managed outside of the tanstack API using normal window.location.hash / <a href="#myAnchor'>? The problem with this being that tanstack won't manage the hash properly so I have to deal with programatically clearing the hash when I go somewhere else... ...
ambitious-aqua
ambitious-aqua12/27/2023

schema enforcement for route path segments

can you enforce a zod schema for something like /t/$bar where bar has to be a number (and useParams returns a number)?
like-gold
like-gold12/26/2023

Old react-location docs

Is there any way to access the docs for react-location that were previously located at https://react-location.tanstack.com/ ? I have a project that is still on react-location, and needed to look at the docs....
correct-apricot
correct-apricot12/26/2023

need help with applying transition to out

Hey folks I'm using the react-transition-group library to apply the transition to outlet when navigating here is my code but it's not working out ```tsx function App() { const { location } = useRouterState(); return (...
adverse-sapphire
adverse-sapphire12/26/2023

How to define a 404 or not found page in SSR file based ? (v1.0.0)

Hey guys and first thing Merry Christmas ! 🎄 I just updated to v1.0.0 and I want to implement a 404 route in an SSR file based project (same setup as the demo on the documentation). Do you have any information in the documentation about that or a code snippet somewhere please ? Just creating a file name not_found.tsx is not doing the trick. I saw a discord post speaking about NotFoundError() but I don't have any clue....