Skip to content

test(form-core): cover onMount field errors before field mount - #2223

Merged
LeCarbonator merged 2 commits into
TanStack:mainfrom
cyphercodes:fix/onmount-field-errors-1366
Aug 17, 2026
Merged

test(form-core): cover onMount field errors before field mount#2223
LeCarbonator merged 2 commits into
TanStack:mainfrom
cyphercodes:fix/onmount-field-errors-1366

Conversation

@cyphercodes

@cyphercodes cyphercodes commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Refs #1366

🎯 Changes

  • Adds regression coverage for a form-level validators.onMount returning field errors before the corresponding field has mounted.
  • Verifies a subsequently mounted FieldApi receives the onMount field error, records the error source as form, and exposes the flattened error list.

✅ 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

  • Tests
    • Added regression coverage to ensure fields mounted after form initialization preserve form-level validation errors, including their source and aggregated error state.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d2dac42d-9c07-494a-b3f3-af43465d8675

📥 Commits

Reviewing files that changed from the base of the PR and between 225878f and 59fec98.

📒 Files selected for processing (1)
  • packages/form-core/tests/FormApi.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/form-core/tests/FormApi.spec.ts

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Adds a regression test for a field mounted after form mount. The test verifies that a form-level onMount validator error remains available on the field, including its source and aggregated error list.

Changes

Form mount error retention

Layer / File(s) Summary
Late field mount error assertions
packages/form-core/tests/FormApi.spec.ts
Adds a test that mounts the form before the field and verifies the retained field error, its "form" source, and the aggregated errors list.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 59fec

This PR adds regression coverage for form-level onMount field errors without changing published behavior or runtime configuration; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related issues

Possibly related PRs

  • TanStack/form#2333 — The test exercises form-level mount-validator field errors and their source handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the required changes, checklist, release impact, testing status, and issue reference.
Title check ✅ Passed The title clearly and concisely describes the regression test for form-level onMount field errors before field mount.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@LeCarbonator LeCarbonator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@nx-cloud

nx-cloud Bot commented Aug 17, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 59fec98

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

☁️ Nx Cloud last updated this comment at 2026-08-17 06:07:10 UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-form

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

@tanstack/form-core

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

@tanstack/form-devtools

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

@tanstack/lit-form

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

@tanstack/preact-form

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

@tanstack/react-form

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

@tanstack/react-form-devtools

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

@tanstack/react-form-nextjs

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

@tanstack/react-form-remix

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

@tanstack/react-form-start

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

@tanstack/solid-form

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

@tanstack/solid-form-devtools

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

@tanstack/svelte-form

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

@tanstack/vue-form

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

commit: 59fec98

@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.
✅ Project coverage is 89.78%. Comparing base (6892ed0) to head (59fec98).
⚠️ Report is 273 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2223      +/-   ##
==========================================
- Coverage   90.35%   89.78%   -0.57%     
==========================================
  Files          38       66      +28     
  Lines        1752     3232    +1480     
  Branches      444      812     +368     
==========================================
+ Hits         1583     2902    +1319     
- Misses        149      296     +147     
- Partials       20       34      +14     

☔ 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.

@LeCarbonator
LeCarbonator merged commit 57a855b into TanStack:main Aug 17, 2026
9 checks passed
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.

3 participants