T
TanStack2y ago
optimistic-gold

[SOLVED] Does validateSearch not work with createLazyFileRoute?

I'm learning how to do redirects, and I'd like to place a redirect search param on one of my routes. I'm coming across an error stating
Object literal may only specify known properties, and 'validateSearch' does not exist in type 'LazyRouteOptions'.ts(2353)
Object literal may only specify known properties, and 'validateSearch' does not exist in type 'LazyRouteOptions'.ts(2353)
I've restarted my editor and this is still the case, is validateSearch simply not possible with createLazyFileRoute?
3 Replies
rival-black
rival-black2y ago
Yeah, if you need validateSearch you should put it in a createRouteFile to defined the search and everything in a none lazy file and then use it on the lazy file.
rival-black
rival-black2y ago
Code Splitting | TanStack Router Docs
Code splitting and lazy loading is a powerful technique for improving the bundle size and load performance of an application. Reduces the amount of code that needs to be loaded on initial page load
No description
extended-salmon
extended-salmon2y ago
Yep. Lazy files can only define components for now Everything else is considered critical and thus needs to be sync

Did you find this page helpful?