fix(form-core): restrict form group membership to delimited field paths #2338
main fromrefs/pull/2338/head·opened 🎯 Changes#
FormGroupApi.getRelatedFields() and the group filter in FieldApi.validate() match members with a bare startsWith, so top-level step1Extra joins group step1: touched by the group's submit, counted by areRelatedFieldsValid(), and re-running its validators. Both now use isFieldInGroup, which requires a . or [ boundary, as #2318 did for deleteField. Added tests fail on main.
Fixes #2337
✅ 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#
Bug Fixes
- Corrected form-group field matching to recognize only dot- or bracket-delimited paths.
- Prevented similarly prefixed fields from being incorrectly validated, touched, marked invalid, or triggering group-level change validation.
Tests
- Added regression coverage for fields with shared name prefixes.
- 1
View your CI Pipeline Execution ↗ for commit 54170a6c413d64b6ba509ca2834631843028b426
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 4m 13s View ↗ nx run-many --target=build --exclude=examples/**✅ Succeeded 40s View ↗
☁️ Nx Cloud last updated this comment at
2026-08-17 05:54:44UTCMore templates
- @tanstack/form-example-angular-array
- @tanstack/form-example-angular-large-form
- @tanstack/form-example-angular-multi-step-wizard
- @tanstack/form-example-angular-simple
- @tanstack/form-example-angular-standard-schema
- @tanstack/form-example-lit-array
- @tanstack/form-example-lit-large-form
- @tanstack/form-example-lit-multi-step-wizard
- @tanstack/form-example-lit-simple
- @tanstack/form-example-lit-standard-schema
- @tanstack/form-example-lit-ui-libraries
- @tanstack/form-example-preact-multi-step-wizard
- @tanstack/form-example-preact-simple
- @tanstack/form-example-react-array
- @tanstack/form-example-react-compiler
- @tanstack/form-example-react-composition
- @tanstack/form-example-react-devtools
- @tanstack/form-example-react-dynamic
- @tanstack/form-example-react-expo
- @tanstack/field-errors-from-form-validators
- @tanstack/form-example-react-large-form
- @tanstack/form-example-react-multi-step-wizard
- @tanstack/form-example-react-next-server-actions
- @tanstack/form-example-react-next-server-actions-zod
- @tanstack/form-example-react-query-integration
- @tanstack/form-example-remix
- @tanstack/form-example-react-simple
- @tanstack/form-example-react-standard-schema
- @tanstack/form-example-react-tanstack-start
- @tanstack/form-example-react-ui-libraries
- @tanstack/form-example-solid-array
- @tanstack/form-example-solid-devtools
- @tanstack/form-example-solid-large-form
- @tanstack/form-example-solid-multi-step-wizard
- @tanstack/form-example-solid-simple
- @tanstack/form-example-solid-standard-schema
- @tanstack/form-example-svelte-array
- @tanstack/form-example-svelte-large-form
- @tanstack/form-example-svelte-multi-step-wizard
- @tanstack/form-example-svelte-simple
- @tanstack/form-example-svelte-standard-schema
- @tanstack/form-example-vue-array
- @tanstack/form-example-vue-multi-step-wizard
- @tanstack/form-example-vue-simple
- @tanstack/form-example-vue-standard-schema
@tanstack/angular-form
npm i https://pkg.pr.new/@tanstack/angular-form@2338@tanstack/form-core
npm i https://pkg.pr.new/@tanstack/form-core@2338@tanstack/form-devtools
npm i https://pkg.pr.new/@tanstack/form-devtools@2338@tanstack/lit-form
npm i https://pkg.pr.new/@tanstack/lit-form@2338@tanstack/preact-form
npm i https://pkg.pr.new/@tanstack/preact-form@2338@tanstack/react-form
npm i https://pkg.pr.new/@tanstack/react-form@2338@tanstack/react-form-devtools
npm i https://pkg.pr.new/@tanstack/react-form-devtools@2338@tanstack/react-form-nextjs
npm i https://pkg.pr.new/@tanstack/react-form-nextjs@2338@tanstack/react-form-remix
npm i https://pkg.pr.new/@tanstack/react-form-remix@2338@tanstack/react-form-start
npm i https://pkg.pr.new/@tanstack/react-form-start@2338@tanstack/solid-form
npm i https://pkg.pr.new/@tanstack/solid-form@2338@tanstack/solid-form-devtools
npm i https://pkg.pr.new/@tanstack/solid-form-devtools@2338@tanstack/svelte-form
npm i https://pkg.pr.new/@tanstack/svelte-form@2338@tanstack/vue-form
npm i https://pkg.pr.new/@tanstack/vue-form@2338commit:
54170a6:warning: Please install the
to ensure uploads and comments are reliably processed by Codecov.
Codecov Report#
:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 89.78%. Comparing base (
6892ed0) to head (54170a6). :warning: Report is 275 commits behind head on main. :exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.Additional details and impacted files
@@ Coverage Diff @@ ## main #2338 +/- ## ========================================== - 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:umbrella: View full report in Codecov by Harness. :loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
HDPark95(GitHub profile, opens in a new tab) linked this to fix #2337
Sign in to join this conversation.
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:
83e24216-733b-4edf-ac78-9ae7cdfbe6b3📥 Commits
Reviewing files that changed from the base of the PR and between 7b8fc1d17fdfc3dbdb81077820f900bdc4bb28fd and 54170a6c413d64b6ba509ca2834631843028b426.
📒 Files selected for processing (4)
.changeset/wild-donkeys-shave.mdpackages/form-core/src/FieldApi.tspackages/form-core/src/FormGroupApi.tspackages/form-core/tests/FormGroupApi.spec.tsIncluded review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.
📝 Walkthrough
Walkthrough#
Changes#
Form group membership
packages/form-core/src/FieldApi.ts,packages/form-core/src/FormGroupApi.tsisFieldInGroupfor dot- and bracket-delimited path matching.packages/form-core/tests/FormGroupApi.spec.ts,.changeset/wild-donkeys-shave.mdstep1Extrais not treated as a member ofstep1. A patch changeset records the behavior change.Estimated code review effort: 2 (Simple) | ~10 minutes
Merge Risk: ⚪ Minimal · up to
54170The change narrows form-group matching to delimited field paths and adds focused coverage; no actionable merge-blocking risk remains after normal checks and review.
Possibly related PRs
deleteField.Suggested reviewers:
crutchcorn🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
#2337.✨ Finishing Touches
🧪 Generate unit tests (beta)
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