-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
(docs): update search params guide for zod 3.24.0+ with Standard Schema #5428
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughDocumentation for React router search-params was rewritten to detail Zod 3.24.0+ adapter-less validation, provide adapter-based paths for older Zod and other libraries, add full examples, warnings, and clarify typing, error handling, and Link/navigation implications. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant R as Route
participant VS as validateSearch
participant Z as Zod 3.24.0+
participant A as Adapter (Zod<3.24 / Other libs)
participant H as onError Handler
U->>R: Navigate with search params
R->>VS: validateSearch(params)
alt Adapter-less (Zod ≥ 3.24.0)
VS->>Z: parse(params)
alt Valid
Z-->>VS: parsed, typed result
VS-->>R: ok(result)
else Invalid
Z-->>VS: error
VS->>H: onError(error)
H-->>VS: fallback/default
VS-->>R: fallback result
end
else Adapter-based (Zod<3.24 / other schema libs)
VS->>A: coerce/transform(params)
alt Valid
A-->>VS: parsed, typed result (via adapter)
VS-->>R: ok(result)
else Invalid
A-->>VS: error
VS->>H: onError(error)
H-->>VS: fallback/default (.default()/.catch())
VS-->>R: fallback result
end
end
R-->>U: Render with validated search state
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)docs/**/*.{md,mdx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
docs/{router,start}/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
View your CI Pipeline Execution ↗ for commit 470607c
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/nitro-v2-vite-plugin
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-static-server-functions
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
Zod 3.24.0+ implements Standard Schema, therefore it can it be used without an adapter just as the Arktype, Valibot and Effect guides instruct. This docs change shows users how to use zod 3.24.0+ to validate search params without requiring the use of the @tanstack/zod-adapter package.
Summary by CodeRabbit