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

frail-apricot
frail-apricot9/12/2023

Is it possible to remove the trailing slash?

My route tree is setup like whats in the picture below. When going to the "search page" the generated route is /agreements/ and when using search params, it comes out to something similar to /agreements/?page=1&size=10. Similarly, when navigating to the item page, the generated url looks like /agreements/12345/. Is it possible to remove that trailing slash to get routes to look like /agreements , /agreements?page=1&size=10, and /agreements/12345?...
No description
stormy-gold
stormy-gold9/11/2023

Is there a problem starting with version 0.0.1-beta.168?

Starting with this version, I have a problem with Safari iOS. I'm testing in the simulator and on a real iPhone X device. I have tabs that are <Link>. And very often, when I click on a Link, it doesn't do the navigation. I have to click a second time. I tried to put an onClick listener on the Link and I can clearly see that some events are not being received. However, we have all the touch events. And the strangest thing is that if I do onTouchStart={evt => evt.preventDefault()} then my...
dependent-tan
dependent-tan9/9/2023

how to do route groups?

Is there a way to do route groups for the same "/" path, like in next.js? (https://nextjs.org/docs/app/building-your-application/routing/route-groups) So we would have / (home page uses <Root /> component as a layout...
afraid-scarlet
afraid-scarlet9/8/2023

Support for base path?

I was wondering if it's possible to set a base path for the router such that all the routes are relative to that value, not unlike React Router's basename property. The use case is that I want to use tanstack router for an app that sits at at site.com/app such that the index would be site.com/app/index, but ideally you wouldn't have to track that base parameter as you're navigating around....
harsh-harlequin
harsh-harlequin9/7/2023

Vitest rendering an empty div when RouterProvider is used

I have found that when unit testing with Vitest, if I pass a RouterProvider to the render function, the result is always a empty div, i.e: ``` <body> <div /> </body>...
like-gold
like-gold9/7/2023

Getting routeContext on components?

Is it possible to get the routeContext in a sub component under the route?
extended-salmon
extended-salmon9/6/2023

Should match.routeId be a valid routeId?

Is there something wonky about typings here? To me it feels like getRoute should be able to take in routeId from match, but TS says it's not assignable to type 'string'. Stackblitz: https://stackblitz.com/edit/tanstack-router-cqhrcq?file=src%2Fmain.tsx (sorry for reposting this one, posted in the channel yesterday but it didn't got any reaction...
No description
extended-salmon
extended-salmon9/6/2023

Throwing redirect from beforeLoad or loader doesn't work as expected

Im trying to achieve sort of a landing route for my app, which would handle redirecting to the correct language route. Something like this: - / redirects to /{defaultLanguage}, in my example /en - /{invalidLanguage} redirects to /error - /{validLanguage} doesn't redirect anywhere...
wise-white
wise-white9/6/2023

How to install latest version of router cli?

Latest npm release was 9 months ago
abstract-brown
abstract-brown9/4/2023

Going back to previous route

Hey guys, I have a question. Is it possible with the tanstack router to go back to the previous visited route? something like const nav = useNavigate() nav({ to: -1 })...
optimistic-gold
optimistic-gold9/4/2023

Is the useNavigate hook supposed to not be typesafe?

useNavigate doesn't seem to have any types on it from the registered router and getting any on the search params and to properties. useRouter.navigate seems to be fine though.
afraid-scarlet
afraid-scarlet9/3/2023

SearchParams cannot distinguish between an array of 1 and a single primitive value

I'm not entirely sure if I misconfigured something or if the docs are outdated now, but according to https://tanstack.com/router/v1/docs/guide/search-params#json-first-search-params, JSON is supported in search parameters and is encoded into something like: /shop?pageIndex=3&includeCategories=%5B%22electronics%22%2C%22gifts%22%5D&sortBy=price&desc=true However in a sandbox I'm using to test this functionality, I'm noticing that arrays are represented as key=firstValue&key=secondValue. Calling useSearch() against this results in { key: ['firstValue', 'secondValue'] }. The issue is that if you set an array of 1, the url is in the same format as if you didn't use an array at all, thus calling useSearch results in { key: 'firstValue' } instead of { key: ['firstValue']}....
afraid-scarlet
afraid-scarlet9/3/2023

useParams arguments no longer optional

I was using the beta version 169, and I was able to get the current path parameters with const params = useParams(). After bumping to version 179, this function call is no longer valid. Reviewing the code, it looks like opts was changed from optional to required. Was this intentional? If so, what is the new syntax if I just want to get the current matching parameters of a page?
ambitious-aqua
ambitious-aqua8/30/2023

Type Inference with useParams and useSearch?

Hoping someone can help me understand why I am not seeing the correct types when using useParams and useSearch. Here is the route definition: ```ts export const resourceTabsSchema = z.object({ tab: z...
correct-apricot
correct-apricot8/30/2023

Which package should I be importing for router?

Is it @tanstack/react-router or @tanstack/router? I've seen them both included as dependencies in example sandboxes, and I'm not sure what the difference is (if any?)
rare-sapphire
rare-sapphire8/30/2023

Angular resolver equivalent for react

Hi, I'm moving app from angular to react and I'm not able to find equivalent. The application consists of 3 pages/steps. user can move back and forward between steps using buttons and even browser buttons....
sensitive-blue
sensitive-blue8/29/2023

Runtime Error while routing.

Sometimes I'm having this error while routing. The probabilty increases if I route rapidly.
No description
rising-crimson
rising-crimson8/29/2023

router base url

Hi guys. Didn't find any mentions about specifying base url for router. Is it possible in beta?
sensitive-blue
sensitive-blue8/29/2023

Navigation Blocking doesn't work with browser's back button.

Navigation blocking works with a Link or useNavigate but doesn't work with browser's back button. Am I missing something?
wise-white
wise-white8/27/2023

Without modify the URL to navigate between different routes or views.

Some applications do not modify URL changes to navigate between different routes or views. In Emberjs it has like locationType: 'none', vuejs has mode: 'abstract'. How to achieve this in react ??