-
-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createLazyFileRoute function doesn't have validateSearch property #1209
Comments
The When you need to define the Route configuration (such as configuring the loader, beforeLoad, validateSearch, etc.), it is done in a separate file which would be named as import { createFileRoute } from '@tanstack/react-router'
import { z } from 'zod'
export const Route = createFileRoute("/about")({
validateSearch: (search) => z.object({ foo: z.string().catch("bar") }).parse(search)
}); TLDR; You'll need both Edit: You can see this in action in the Basic (file based) example in the posts.tsx and the posts.lazy.tsx files. |
It should be pinned, lots of developers are very confused about this feature. |
This has been stated in docs over here, but it's easy to understand why someone could miss it. Tanstack Router covers a lot, and the fact that virtual routes "just work" means people don't see fully read the page on code-splitting and how it works. IMO: Tanstack Router is definitely not the most beginner friendly solution at the moment, and honestly I don't think it ever will be given the kinds of complex stuff it aims to do. But we should see alot of the documentation pages getting a cleanup when we begin the push for v2. |
@SeanCassiere Thank you 🙏 |
Describe the bug
I can't use validateSearch property for lazy file routes as it's for regular file routes
Steps to Reproduce the Bug or Issue
Expected behavior
I expect lazy file routes have same properties as regular file routes
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: