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.
Paul Sachs
StackBlitz
Router Quickstart File Based Example (duplicated) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
1 Reply
foreign-sapphireOP•2w ago
Ah, nvm, you just need to make sure the return object always has optional properties. Not sure why that didn't work when i tried it before, maybe lag in TS or gen 🤷