beforeLoad / validateSearch compatibility issue?
I'm wondering if it's intentional that when utilizing code-based routing, if one attempts to utilize any parameters provided to
beforeLoad (e.g. context) that the type of search parameters provided via inference validateSearch is dropped in consumers utilizing useSearch?
If not, how might one leverage beforeLoad with provided parameters without losing the type inference for search parameters on the same route?
Minimal Repro: https://stackblitz.com/edit/tanstack-router-nrzryj?file=src%2Fmain.tsxDylan Klohr
StackBlitz
Router Kitchen Sink Example (forked) - StackBlitz
Run official live example code for Router Kitchen Sink, created by Tanstack on StackBlitz
4 Replies
protestant-coral•2y ago
the order of
beforeLoad and validateSearchmattersprotestant-coral•2y ago
StackBlitz
Router Kitchen Sink Example (forked) - StackBlitz
Run official live example code for Router Kitchen Sink, created by Tanstack on StackBlitz
protestant-coral•2y ago
Total TypeScript
Sometimes, Object Property Order Matters
Learn why the order you specify object properties in TypeScript matters and how it can affect type inference in your functions.
genetic-orangeOP•2y ago
Thank you 🙏 this fixed the issue