-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Which project does this relate to?
Router
Describe the bug
"version": "1.147.3",
when using useParams with { strict: false }, we are getting unparsed values back, but they are still typed as if they were parsed.
This is caused by useMatch match.params no longer being parsed (compared to the version we upgraded from) match. _strictParams is parsed, but doesn't contain params from the child routes.
This is the patch we applied to fix the issue for us, it seems a bit blunt though but I hope it helps the team quickly narrow down the issue.
@tanstack+react-router+1.147.3.patch
Your Example Website or App
https://stackblitz.com/edit/github-3khftpeu
Steps to Reproduce the Bug or Issue
from the repro url, click the "version" link
https://stackblitz.com/edit/github-3khftpeu
have a child route - createFileRoute with:
params: {
parse: (params) => ({
...params,
"version": parseInt(params["version"]),
}),
stringify: (params) => ({
...params,
"version": ${params["version"]},
}),
},
then in a parent route, do:
const { version } = useParams({ strict: false });
console.log(version); // in the ide, shows up as number | undefined but in the console, shows up as a string.
Expected behavior
I expect the runtime values of useParams to be equal to their type.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.147.3
- OS: macOS
- Browser: Chrome
- Browser Version: 143.0.7499.193
- Bundler: vite
- Bundler Version: 7.1.4
Additional context
No response