is route sorting broken, or is it my understanding?
https://stackblitz.com/edit/tanstack-router-dsvamt?file=src%2Froutes%2Fproduct.%24id.specs.tsx
With two routes defined as
- Product: /product/$id
- Product Specs: /product/$id/specs
Clicking a link to Product Specs actually renders Product.
I would have expected Product Specs to be deemed more specific and so sorted before Product.
Jason Galea
StackBlitz
Router Quickstart File Based Example (forked) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
3 Replies
wise-whiteOP•14mo ago
nvm.. nesting caught me out again.. fixed with a "_" suffix..
https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#non-nested-routes
Routing Concepts | TanStack Router React Docs
TanStack Router supports a number of powerful routing concepts that allow you to build complex and dynamic routing systems with ease.
The Root Route
xenial-black•14mo ago
If these are two individual pages, that don't inherit a route from
products.tsx
, then it could be named as
- products.$id.index.tsx
- products.$id.specs.tsx
wise-whiteOP•14mo ago
ah, nice, that's probably better, thanks!