T
TanStack2y ago
rival-black

route.to not matching ToOptions

I just updated from 1.0.6 to 1.29.2 Using a route.to no longer has the trailing / and doesn't match anything in my router.
The routes still work so my assumption is that ToOptions is the wrong type to use here as it expects the trailing / where route.to trims this slash. Any ideas on how to solve this?
No description
3 Replies
rival-black
rival-blackOP2y ago
GitHub
feat: trailingSlashes option on the type level by chorobin · Pull...
We can infer trailingSlashes from the router and use it to enforce the to prop when navigating. trailingSlashes currently has three options: always | never | preserve. always - we always have a tra...
rival-black
rival-blackOP2y ago
LinkProps appears to be the correct type, ToOptions no longer works
fascinating-indigo
fascinating-indigo2y ago
Yes. You're kind of correct. ATM only index routes have trailing slashes, which is inconsistent with other leaves. Before this suggestion came from the branch but we are only allowing to navigate to a leaf now. The above pr is meant to make things consistent. Either you have trailing slashes on, off or both

Did you find this page helpful?