TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
7.77k stars 565 forks source link

Nested route group interferes with Pathtype #1725

Closed SundayPowerEndre closed 3 months ago

SundayPowerEndre commented 3 months ago

Describe the bug

When i am using nested route groups the Path type (i.e. to: "/page/component/") gets reset such that it reads from the innermost group and to the end.

Say that i have a path that is "/(auth)/org/(graphql)/$orgId/revenue" the Link will autosuggest "/$orgId/revenue" as opposed to the "/org/$orgId/revenue" as i would expect

On version: "@tanstack/react-router": "^1.35.3" i encountered an issue when i attempted to manually preloading a route with the router.preloadRoute() function.

Your Example Website or App

https://stackblitz.com/edit/github-isj4z7?file=src%2Froutes%2F__root.tsx

Steps to Reproduce the Bug or Issue

  1. Use the Link element on Line 30
  2. Attempt to find /org/$orgId/revenue

Expected behavior

I would expect that i could get the full path, so i can target it properly from anywhere in the app.

Screenshots or Videos

Screenshot 2024-06-08 at 17 05 35

Platform

Additional context

I do not know if this is part of the intentional design of route groups, there was limited documentation, but it seemed like a fair interpretation of the feature that nested groups would be supported.

schiller-manuel commented 3 months ago

did this work correctly with a previous version?

SundayPowerEndre commented 3 months ago

Afaik, no. I just added the version in case it was relevant for you guys.

Edit: I just checked with version 1.0.0 and it has the same behaviour.

schiller-manuel commented 3 months ago

released in https://github.com/TanStack/router/releases/tag/v1.35.4 please upgrade @tanstack-router/vite-plugin to 1.35.4

SundayPowerEndre commented 3 months ago

Thank you, and i am impressed with the speed 🙏🏽 Greatly appreciated