docs(react-form): show how to render formErrorMap.onChange when using Standard Schema#2139
Conversation
… Standard Schema The form-level error rendering example uses a function validator returning a string, which renders directly. Readers applying the same pattern to a Standard Schema validator (Zod, Valibot, ArkType, Effect/Schema) hit a TypeScript error because errorMap.onChange is then Record<string, StandardSchemaV1Issue[]>, not a string. Add a note after the example with the iteration pattern needed for the Standard Schema case. Closes TanStack#1564
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe documentation for form-level validation is updated to clarify error-mapping shapes and provide a corrected code example showing proper iteration over Standard Schema validator error records with message extraction instead of direct rendering. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Changes
Closes #1564.
The form-level error rendering example uses a function validator that returns a
string. With a Standard Schema validator (Zod, Valibot, ArkType, Effect/Schema),errorMap.onChangeisRecord<string, StandardSchemaV1Issue[]>instead, so the existing JSX cannot render it directly. Adds a note after the example with the iteration pattern for that case.Checklist
pnpm test:pr.Release Impact
Summary by CodeRabbit