Skip to content

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

Open
cyphercodes wants to merge 1 commit into
TanStack:mainfrom
cyphercodes:fix/onmount-field-errors-1366
Open

test(form-core): cover onMount field errors before field mount#2223
cyphercodes wants to merge 1 commit into
TanStack:mainfrom
cyphercodes:fix/onmount-field-errors-1366

Conversation

@cyphercodes

@cyphercodes cyphercodes commented Jun 25, 2026

Copy link
Copy Markdown

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 coverage for fields mounted after form initialization to ensure form-level mount validation errors are preserved and reflected correctly in the field’s 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

Run ID: c2678e20-473f-445e-b5c1-0f05f19d39d3

📥 Commits

Reviewing files that changed from the base of the PR and between 6a73479 and 225878f.

📒 Files selected for processing (1)
  • packages/form-core/tests/FormApi.spec.ts

📝 Walkthrough

Walkthrough

Adds a test for a field mounted after form mount when the form-level onMount validator returns a field error. The test checks the field’s retained error state, errorSourceMap.onMount, and aggregated errors.

Changes

Form mount error retention

Layer / File(s) Summary
Late field mount error assertions
packages/form-core/tests/FormApi.spec.ts
Adds a FormApi test that mounts the form before the field and verifies the field still reflects the form-level onMount error state.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 I hopped through the form with a curious grin,
A late field appeared, and the errors stayed in.
onMount whispered loud, and the test said “all right,”
With maps and with lists, the bunny’s delight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the new regression test for onMount field errors before the field mounts.
Description check ✅ Passed The description follows the template and includes changes, checklist items, and release impact.
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.

✏️ 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.

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