T
TanStack17mo ago
rare-sapphire

Attempting to navigate to `./` causes type error in new version

Hi everyone. Running into the following issue where trying to navigate to ./ shows a type error asking for params:
const navigate = useNavigate();

navigate({ to: './' });
const navigate = useNavigate();

navigate({ to: './' });
This was working properly in v1.26.16, but recently update the lib to 1.31.21 and seeing the following type error. This is in a reused component, so I can't pass in a from into navigate, as it will always be different.
No description
8 Replies
rare-sapphire
rare-sapphireOP17mo ago
also, trying to navigate to ../ causes another type error now, which def seems wrong:
No description
vicious-gold
vicious-gold17mo ago
Does to='.' without trailing slash work?
rare-sapphire
rare-sapphireOP17mo ago
No typescript error there. Though . and .. aren't shown on the auto-complete. I thought this was a TS only error yesterday, but when I went in to figure out a workaround, I realized navigating to ./ just straight up didnt do anything anymore.
vicious-gold
vicious-gold17mo ago
Yeah. I think there's likely an inconsistency now. We have a trailingSlash option on the router which by default is set to never which means trailing slashes are not valid on the type level. And runtime I think we change to not have a trailing slash also
rare-sapphire
rare-sapphireOP17mo ago
I just found another issue. I think it's a regression of this https://github.com/TanStack/router/issues/1560
GitHub
navigate functions without to but with search causes a route ...
Describe the bug After version 1.31.7 the error started occurring. Related to #1548. @SeanCassiere Your Example Website or App https://stackblitz.com/edit/tanstack-router-1udi7f?file=src%2Froutes%2...
rare-sapphire
rare-sapphireOP17mo ago
I'm gonna have to revert the old version for now, 'cause I gotta get this work done. I'll try to make some time to investigate this more on my end and file some issues. There seems to be a lot of broken stuff between 1.26 and now
ratty-blush
ratty-blush17mo ago
can you please open up a new issue on github?
rare-sapphire
rare-sapphireOP17mo ago
Will do

Did you find this page helpful?