Skip to content

[v2] Create error map fn - #2431

Draft
LeCarbonator wants to merge 2 commits into
alphafrom
create-error-map-fn
Draft

LeCarbonator wants to merge 2 commits into
alphafrom
create-error-map-fn

Conversation

@LeCarbonator

@LeCarbonator LeCarbonator commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Changes

Removes parseIssues in favor of adequate replacements:

  • Form-level and group-level validators: parseIssues created an error map, so createErrorMap can be extended to also accept standard schema issues.
  • Field-level validators: parseIssues was redundant, you can just return the array directly.

BREAKING: parseIssues will no longer be available.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 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

  • New Features
    • Standard Schema validation issues can now be returned directly from field validators, while form and group errors can be mapped through createErrorMap.
    • Submission error handling now supports creating error maps from schema issues or supplied error maps.
    • Readonly arrays are now supported for validation error inputs.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: TanStack/form/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6a8be3db-ca54-4798-a13a-32e59a6afbb7
📥 Commits

Reviewing files that changed from the base of the PR and between 3d39077 and 6c2d577.

📒 Files selected for processing: 23
  • examples/angular/field-groups/src/bound-field.component.ts
  • examples/lit/field-groups/src/field-bounds.ts
  • examples/preact/field-groups/src/fieldGroups/fieldBounds.tsx
  • examples/react/field-groups/src/fieldGroups/fieldBounds.tsx
  • examples/solid/field-groups/src/fieldGroups/fieldBounds.tsx
  • examples/svelte/field-groups/src/fieldGroups/UpperBoundFields.svelte
  • packages/form-core/src/FormApi/FormApi.public.ts
  • packages/form-core/src/FormApi/handleSubmit.lib.ts
  • packages/form-core/src/FormGroupApi/FormGroupApi.lib.ts
  • packages/form-core/src/createErrorMap.lib.ts
  • packages/form-core/src/ssr.lib.ts
  • packages/form-core/src/types.public.ts
  • packages/form-core/src/utils.lib.ts
  • packages/form-core/src/validation.public.ts
  • packages/form-core/src/validation/execution.lib.ts
  • packages/form-core/src/validation/mount.lib.ts
  • packages/form-core/src/validation/pipeline.lib.ts
  • packages/form-core/tests/FormApi/submission-handling.spec.ts
  • packages/form-core/tests/FormApi/validation.spec.ts
  • packages/form-core/tests/FormGroupApi/FormGroupApi.spec.ts
  • packages/form-core/tests/validation-pipeline.test.ts
  • packages/form-core/tests/validation-public.test.ts
  • packages/form-core/tests/validation.test-d.ts
💤 Files with no reviewable changes: 1
  • packages/form-core/tests/validation-public.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

Validation and submission contexts now use createErrorMap instead of parseIssues. Field validators can return Standard Schema issue arrays directly. The public validation types accept readonly inputs, and the field-group examples use the updated validation pattern.

Changes: Form Error Mapping

Layer / File(s) Summary
Error-map and readonly input contracts
packages/form-core/src/types.public.ts, packages/form-core/src/utils.lib.ts, packages/form-core/src/validation.public.ts, packages/form-core/tests/validation-public.test.ts, packages/form-core/tests/validation.test-d.ts
Validation error inputs now accept readonly values. CreateErrorMapFn has overloads for error maps and Standard Schema issues. The standalone createErrorMap export and the parseIssues type declarations are removed.
Validation error routing
packages/form-core/src/createErrorMap.lib.ts, packages/form-core/src/validation/*, packages/form-core/src/FormGroupApi/FormGroupApi.lib.ts, packages/form-core/src/ssr.lib.ts, examples/*/field-groups/*, packages/form-core/tests/FormApi/validation.spec.ts, packages/form-core/tests/FormGroupApi/FormGroupApi.spec.ts, packages/form-core/tests/validation-pipeline.test.ts, packages/form-core/tests/validation.test-d.ts
Form and group validation contexts create error maps using current values. Field validators return Standard Schema issues directly. Examples and tests use these updated patterns.
Submission error maps
packages/form-core/src/FormApi/FormApi.public.ts, packages/form-core/src/FormApi/handleSubmit.lib.ts, packages/form-core/tests/FormApi/submission-handling.spec.ts, packages/form-core/tests/validation.test-d.ts
The submit context provides createErrorMap with overloads for error maps and Standard Schema issues. Submission errors retain the map, and submission documentation and tests use the new helper.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Suggested reviewers: crutchcorn

Merge Risk: ⚪ Minimal · up to 6c2d5

This change replaces issue parsing with createErrorMap and lets field validators return schema issues directly. No concrete merge-blocking problem was identified. The PR is declared breaking, so the release checklist and changeset still need attention.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the removal of parseIssues and lists the main replacements. However, this breaking published API change does not include a changeset, and the test-status checklist remains inc… Add the required changeset for the published breaking API change, select the applicable Release Impact option, and confirm whether pnpm test:pr was run or does not apply.
Docstring Coverage Warning Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 21 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: creating an error map function as part of the v2 API update.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the removal of parseIssues and lists the main replacements. However, this breaking published API change does not include a changeset, and the test-status checklist remains incomplete.

Resolution

Add the required changeset for the published breaking API change, select the applicable Release Impact option, and confirm whether pnpm test:pr was run or does not apply.

Full details: Docstring Coverage

Explanation

Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 21 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nx-cloud

nx-cloud Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 6c2d577

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 4m 18s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded 21s View ↗

☁️ Nx Cloud last updated this comment at 2026-10-16 09:00:23 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

8 package(s) bumped directly, 5 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/angular-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/form-core 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/lit-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/preact-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/react-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/solid-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/svelte-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/vue-form 2.0.0-alpha.2 → 2.0.0-alpha.3 Changeset
@tanstack/react-form-nextjs 2.0.0-alpha.2 → 2.0.0-alpha.3 Dependent
@tanstack/react-form-start 2.0.0-alpha.2 → 2.0.0-alpha.3 Dependent

🟩 Patch bumps

Package Version Reason
@tanstack/form-devtools 1.0.0-alpha.2 → 1.0.0-alpha.3 Dependent
@tanstack/react-form-devtools 1.0.0-alpha.2 → 1.0.0-alpha.3 Dependent
@tanstack/solid-form-devtools 1.0.0-alpha.2 → 1.0.0-alpha.3 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-form

npm i https://pkg.pr.new/@tanstack/angular-form@2431

@tanstack/form-core

npm i https://pkg.pr.new/@tanstack/form-core@2431

@tanstack/form-devtools

npm i https://pkg.pr.new/@tanstack/form-devtools@2431

@tanstack/lit-form

npm i https://pkg.pr.new/@tanstack/lit-form@2431

@tanstack/preact-form

npm i https://pkg.pr.new/@tanstack/preact-form@2431

@tanstack/react-form

npm i https://pkg.pr.new/@tanstack/react-form@2431

@tanstack/react-form-devtools

npm i https://pkg.pr.new/@tanstack/react-form-devtools@2431

@tanstack/react-form-nextjs

npm i https://pkg.pr.new/@tanstack/react-form-nextjs@2431

@tanstack/react-form-start

npm i https://pkg.pr.new/@tanstack/react-form-start@2431

@tanstack/solid-form

npm i https://pkg.pr.new/@tanstack/solid-form@2431

@tanstack/solid-form-devtools

npm i https://pkg.pr.new/@tanstack/solid-form-devtools@2431

@tanstack/svelte-form

npm i https://pkg.pr.new/@tanstack/svelte-form@2431

@tanstack/vue-form

npm i https://pkg.pr.new/@tanstack/vue-form@2431

commit: 6c2d577

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (alpha@3d39077). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##             alpha    #2431   +/-   ##
========================================
  Coverage         ?   95.10%           
========================================
  Files            ?      116           
  Lines            ?     4456           
  Branches         ?     1005           
========================================
  Hits             ?     4238           
  Misses           ?      208           
  Partials         ?       10           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

2 participants