-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative navigation always expects a search
param?
#1838
Comments
Getting the same issue, upgrading from 1.29 to 1.40. |
The error you see is caused by the It defaults to to: '..', If you change see https://stackblitz.com/edit/tanstack-router-wxombr?file=src%2Froutes%2Fposts.%24postId.tsx |
@schiller-manuel Thanks a lot for pointing it out, that was not clear to me from the TS error! Do you think the type should be tweaked, either to be more permissive (allowing trailing slashes |
Let's ask @chorobin about his opinion on this |
Looks like in the latest version search param is required if route has validateSearch set. I have zod schema with all properties set to optional but link and navigate still require search to be provided |
Yeah, we should at least not suggest '../' and suggest '..' instead |
Do you have an example where this is not working? Generally the type logic for required/optional search params works off the basis that, if |
Describe the bug
When using navigation (e.g.
navigate
/redirect
) with afrom
and relativeto
, it seems TypeScript always complains about thesearch
param being required, even if none of the routes define avalidateSearch
.This example works at runtime, but TypeScript complains:
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-ycpp7o?file=src%2Froutes%2Fposts.%24postId.tsx
Steps to Reproduce the Bug or Issue
posts.$postId.tsx
file and go to the render functionExpected behavior
I expect that if the
to
route doesn't provide avalidateSearch
, it's not a required prop and TypeScript doesn't complain.Screenshots or Videos
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: