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

stormy-gold
stormy-gold4/15/2024

Best approach for navigation back and forward?

I wonder what's the best way to handle situations like that: - let's say I have paginated page /posts - /posts/1 is a single post page which has 'back' link inside If there would be no such a button, user would be forced to use browser navigation which would go back to the previous page (not push another route). As far as I understand, I can use history.go(-1), but if user has just directly opened the /posts/1 page , that would redirect him to the page he initialy came from. Of course I can pass some search params like backURL, but the downside of this is that it pushes a new route to the history. Is there something like in-app router history, that would remember the previous in-app pages? I hope it's not a stupid question 🙂...
mute-gold
mute-gold4/14/2024

Root loader with notFound throws suspense error

Whenever I add a loader to root and throw a notFound, i get a suspense error. it seems to be originating from https://github.com/TanStack/router/blob/f856306b33a176b0d8fa6e8a3861d0eb2fff4854/packages/react-router/src/Matches.tsx#L285. I'm not sure why the route goes into pending state since it doesnt do it anywhere else from what I can tell. is there some other way im meant to do this or should i open an issue on github? https://stackblitz.com/edit/tanstack-router-7kqr7z?file=src%2Froutes%2F__root.tsx (visit /123 to test)...
ambitious-aqua
ambitious-aqua4/13/2024

Opting out of parent layout(s) in child route?

Is there a way to opt-out of the parent layout(s) from a child route using the file-based router? Take this structure for example: ``` -dashboard – _root.tsx...
flat-fuchsia
flat-fuchsia4/13/2024

Loader not waiting for all async operations

When I await multiple promises in a loader function, the page gets rendered as soon as I hit the first await. Example: ```typescript ...
deep-jade
deep-jade4/12/2024

Parallel routes/named outlets

A while ago someone asked about the prospect of having parallel routes (similar to Next.js) or something like named outlets (https://github.com/TanStack/router/discussions/605). I noticed there’s a docs page updated around January time (https://github.com/TanStack/router/blob/main/docs/framework/react/guide/parallel-routes.md) and I’m wondering if the feature is on the way in the near future?...
yelping-magenta
yelping-magenta4/11/2024

No routeTree.gen.ts file

I'm walking through the "Getting Started" guide on the website and I'm not seeing a routeTree.gen.ts file in my project. In the docs it says it should be generated for me. Do i need to run a command to generate it for me? I'm using the @tanstack/router-vite-plugin and have installed everything using yarn.
No description
ratty-blush
ratty-blush4/11/2024

make trailing slashes configurable

I can see that right now, TanStack router always removes trailing slashes. This might be fine for most cases, but for instance, we serve an SPA from a django server, which is customized to always have trailing slashes. So if I load the browser on /foo/, the server will serve the correct SPA, but then TanStack router takes away the trailing slash, leaving /foo. If the user then re-loads the page, we're seeing a server-side redirect from django again towards /foo/, and then the router takes the slash away again....
xenial-black
xenial-black4/10/2024

using tanstack router inside react router

Hi, finally found time for upgrading the router after a really busy period at work. Looks like this bug has had a regression: https://discord.com/channels/719702312431386674/1137008557838057633. The issue was fixed in beta 136, and the code added there has since been removed....
generous-apricot
generous-apricot4/10/2024

parent is undefined

Hi there, I am new to TanStack Router, I am using this for MircroFE, i have set a base path for on createRouter I can able to load the page if i enter the right url but when i use link from nav i am getting parent is undefined Can anyone help me...
No description
xenophobic-harlequin
xenophobic-harlequin4/9/2024

Redirect to relative path does redirect to wrong path

Hi. I updated router to its latest version 1.26.16 and saw that this code wasn't redirecting to /app/dashboard but to /dashboard. ```export const Route = createFileRoute('/app/')({ beforeLoad: async ({ context: { queryClient } }) => { throw redirect({...
eastern-cyan
eastern-cyan4/9/2024

Link from getRouteApi

Assuming I have a getRouteApi already in scope, is there any shortcut to forming a Link to/from the route my getRouteApi is pointing to without going through a .useMatch() and using its pathname? ``` const pageApi = getRouteApi('...'); const Cmp = () => {...
extended-salmon
extended-salmon4/8/2024

Context is not up to date after navigate

Hey guys, I'm trying to handle redirection after login in. For now, I got my Login Component that is working fine, it updates the AuthContext so I can use my user globally. I would like to be able to redirect my user to /dashboard after the successful login. My /dashboard route is a protected route, I can access it only if context.useris not null. ...
harsh-harlequin
harsh-harlequin4/8/2024

Different Suspense behaviour depending on where a user comes from

I have a question about Suspense, that might be more a general React question, but maybe someone has an idea with respect to tanstack Router. Is it possible to have different Suspense behaviour (different Suspense boundaries), depending on how a user reaches a route? Example: I have a Suspense component around Route /a:...
exotic-emerald
exotic-emerald4/8/2024

Breadcrumbs

Does anyone have a hooks for returning route breadcrumbs?
typical-coral
typical-coral4/8/2024

Error: Redirecting from parent to child on load

I think what I'm doing has a better solution, but I'm not sure what to do. I have a folder structure that looks something like this: ``` routes parent...
ratty-blush
ratty-blush4/7/2024

Loader in parent route runs again if only a new child route is rendered

I would think that my loader only runs once in the parent route if a new child route is rendered, for example: loader in dashboard.tsx only runs once if user navigates from dashboard.users.tsx to dashboard.roles.tsx ? But it doesn't. How can i possibly achieve this with file based routing?
grumpy-cyan
grumpy-cyan4/7/2024

Using `navigate` in a providers handler before RouterProvider instance

The docs describes an example for passing a context into the Router (https://tanstack.com/router/latest/docs/framework/react/guide/authenticated-routes#authentication-using-react-contexthooks). I have a very similar situations to this, however in my situation I need to leverage the router within a callback of the provider. Building on the example from the docs, my situation would be equivalent to this: ```tsx...
conscious-sapphire
conscious-sapphire4/6/2024

Layout route with `routeFilePrefix `

I'm using vite plugin to generate routes from files How do I create layout route when using routeFilePrefix? I have following folder structure?...
continuing-cyan
continuing-cyan4/6/2024

Confirm when user press the back button of browser

Can I confirm when user press the back button of browser? Hope your help, thank you
eager-peach
eager-peach4/5/2024

Can we have different types for search params input and output?

By search params input I mean:
<Link to="/" search={{page: 1}} /> // <-- input is the arguments we pass to the `search` prop
<Link to="/" search={{page: 1}} /> // <-- input is the arguments we pass to the `search` prop
...