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
vicious-gold•15mo ago
the order of
beforeLoad
and validateSearch
mattersvicious-gold•15mo ago
StackBlitz
Router Kitchen Sink Example (forked) - StackBlitz
Run official live example code for Router Kitchen Sink, created by Tanstack on StackBlitz
vicious-gold•15mo 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.
yammering-amberOP•15mo ago
Thank you 🙏 this fixed the issue