fix(form-core): clear form errors only on change #2453
main fromrefs/pull/2453/head·opened 🎯 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.
- 1
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 12eea6d647d5c5b5692bf42b389210dbe750ccc9 and e5ebe68cb15a7129c7d0c92ec46c822ba91cf567.
Files selected for processing: 2-
packages/form-core/src/FormApi.tspackages/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
Priority:Layer / File(s) Summary Error clearing conditions and regression test
packages/form-core/src/FormApi.ts,packages/form-core/tests/FormApi.spec.tsSubmit and server errors clear only after error-free change validation. A regression test checks that blur preserves an existing form-level submit error. LowEstimated 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 toe5ebe-
No actionable merge-blocking risk remains.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check 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 checks: 4 passed-
Check name Status Explanation Title check 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 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 Check skipped because no linked issues were found for this pull request. Out of Scope Changes check 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.
Comment `@coderabbitai help` to get the list of available commands.-
Sign in to join this conversation.
⚠️ No Changeset found#
Latest commit: e5ebe68cb15a7129c7d0c92ec46c822ba91cf567
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