Skip to content

docs(react-form): show how to render formErrorMap.onChange when using Standard Schema#2139

Open
dfedoryshchev wants to merge 1 commit intoTanStack:mainfrom
dfedoryshchev:docs/standard-schema-form-error-rendering
Open

docs(react-form): show how to render formErrorMap.onChange when using Standard Schema#2139
dfedoryshchev wants to merge 1 commit intoTanStack:mainfrom
dfedoryshchev:docs/standard-schema-form-error-rendering

Conversation

@dfedoryshchev
Copy link
Copy Markdown

@dfedoryshchev dfedoryshchev commented Apr 25, 2026

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.onChange is Record<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

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Documentation
    • Updated validation guide with clarified error-mapping examples for different validator types
    • Improved error rendering guidance with practical iteration approach for displaying validation messages

… 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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 33e893ef-7176-4a1d-ba6b-923ec9640bd7

📥 Commits

Reviewing files that changed from the base of the PR and between 1cdd97a and b4ee463.

📒 Files selected for processing (1)
  • docs/framework/react/guides/validation.md

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Documentation – Validation Guide
docs/framework/react/guides/validation.md
Clarifies the distinction between function validator errors (single string) and Standard Schema validator errors (record structure). Replaces incorrect direct rendering of error object with proper iteration and issue.message extraction pattern.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A validator's woe, once tangled and unclear,
Now hops through errors with a message so dear,
No more raw records in JSX we show,
Just iterate and extract—watch validation grow! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding documentation on how to render formErrorMap.onChange when using Standard Schema validators.
Description check ✅ Passed The description follows the template with all required sections completed: Changes, Checklist items marked, and Release Impact clearly indicated as docs-only.
Linked Issues check ✅ Passed The PR directly addresses issue #1564 by adding documentation showing how to iterate and render formErrorMap.onChange for Standard Schema validators, resolving the TypeScript error reported.
Out of Scope Changes check ✅ Passed All changes are scoped to documentation updates addressing the specific issue of rendering form-level errors with Standard Schema validators, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Official docs example for form level schema validation is giving an error when used with Zod

1 participant