TanStackT
TanStack4mo ago
1 reply
radical-lime

Optional search params with redirect calls

I've noticed that if I add a validateSearch option to my route, all calls to redirect({ to: "/whatever-route" }) now requires a search param (at least for typescript checks to pass). Is there a way to make this search field actually optional?

See example reproduction: https://stackblitz.com/edit/tanstack-router-f3awwzqj?file=src%2Froutes%2Fold-about.tsx

This might be a bug, just wanted to validate before logging. Also ignore the overly simplistic validateSearch but it should be sufficient to prove the issue.
StackBlitzPaul Sachs
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
Router Quickstart File Based Example (duplicated) - StackBlitz
Was this page helpful?