Skip to content

fix(form-core): clear form errors only on change - #2453

Open
suryaprakashsingh1705-sys wants to merge 1 commit into
TanStack:mainfrom
suryaprakashsingh1705-sys:fix/2295-form-error-clearing
Open

suryaprakashsingh1705-sys wants to merge 1 commit into
TanStack:mainfrom
suryaprakashsingh1705-sys:fix/2295-form-error-clearing

Conversation

@suryaprakashsingh1705-sys

@suryaprakashsingh1705-sys suryaprakashsingh1705-sys commented Oct 28, 2026 •

Copy link
Copy Markdown

🎯 Changes

✅ 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

  • Bug Fixes
    • Form-level submission and server errors are no longer cleared by validation on blur; they are cleared when a change-triggered validation succeeds.

@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e5ebe68

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: TanStack/form
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 12eea6d
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed353beb-482a-4973-b56e-2982806a1c62
Commits

Reviewing files that changed from the base of the PR and between 12eea6d and e5ebe68.

Files selected for processing: 2
  • packages/form-core/src/FormApi.ts
  • packages/form-core/tests/FormApi.spec.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 now clears existing submit and server errors only when change validation returns no errors. A regression test verifies that blurring an unchanged field preserves a form-level submit error.

Changes: Validation Error Clearing

Layer / File(s) Summary
Error clearing conditions and regression test
packages/form-core/src/FormApi.ts, packages/form-core/tests/FormApi.spec.ts
Submit and server errors clear only after error-free change validation. A regression test checks that blur preserves an existing form-level submit error.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • TanStack/form#2436: Adds tests for event-specific error clearing and replacement behavior addressed by this change.
  • TanStack/form#2448: Adds tests for event-error clearing rules related to the updated validation condition.

Suggested reviewers: lecarbonator

Merge Risk: Minimal · up to e5ebe

No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description contains only the unchanged template. The "🎯 Changes" section is empty and has only the HTML comment prompt. It does not explain what changed or why. The checklist items are all unchec… Fill in the "🎯 Changes" section. Describe the change and its motivation. State that validateSync now clears submit and server errors only on change validation with no errors, and that this fixes blur clearing a form-level onSubmit error. Ch…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "fix(form-core): clear form errors only on change" matches the main change. The summary says validateSync now clears submit and server errors only when validation is triggered by change and …
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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: Title check

Explanation

The title "fix(form-core): clear form errors only on change" matches the main change. The summary says validateSync now clears submit and server errors only when validation is triggered by change and produces no errors. The title is specific and follows a conventional commit style. It names the package and the behavior. It does not mention the added regression test, but that is a minor supporting detail.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Full details: Description check

Explanation

The description contains only the unchanged template. The "🎯 Changes" section is empty and has only the HTML comment prompt. It does not explain what changed or why. The checklist items are all unchecked, including the test item and the changeset item under Release Impact. The change touches published code in packages/form-core, so a changeset is likely required, but the author has not indicated one was generated.

Resolution

Fill in the "🎯 Changes" section. Describe the change and its motivation. State that validateSync now clears submit and server errors only on change validation with no errors, and that this fixes blur clearing a form-level onSubmit error. Check the test checkbox after running pnpm test:pr, or explain why tests do not apply. Check the Release Impact item for published code and add a changeset, or mark the change as docs/CI/dev-only if that is correct.

Finishing Touches
🧪 Generate unit tests (beta)
  • 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.

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.

1 participant