-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Which project does this relate to?
Router
Describe the bug
I use following code:
import { getRouteApi } from '@tanstack/react-router'
const route = getRouteApi('/dashboard/$companyId')
export default function useOptionalCompanyId(): string | undefined {
try {
const { companyId } = route.useParams()
return companyId
} catch {
return undefined
}
}This methods returns undefined for routes such as:
/dashboard/32a0c53f-0307-44eb-8e60-3be04046d570/editor
/dashboard/32a0c53f-0307-44eb-8e60-3be04046d570
etc.
Your Example Website or App
None
Steps to Reproduce the Bug or Issue
Use latest tanstack version
use the hook
go into a child route
the hook will return undefined
Expected behavior
I expect it to find the companyId
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.157.16
- OS: MacOS
- Browser: chrome
- Bundler: vite
- Bundler Version: latest
Additional context
Seems like the routeTree.gen.ts is updated with the new version for @tanstack/router-plugin it works in 1.150.0
Metadata
Metadata
Assignees
Labels
No labels