Skip to content
Source
Sign inSign up
TanStack/form

fix(form-core): restrict form group membership to delimited field paths #2338

OpenHDPark95(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/2338/headopened

🎯 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. 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: 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.md
      • packages/form-core/src/FieldApi.ts
      • packages/form-core/src/FormGroupApi.ts
      • packages/form-core/tests/FormGroupApi.spec.ts

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


      📝 Walkthrough

      Walkthrough

      Changes

      Form group membership

      Layer / File(s)Summary
      Boundary-aware membership checks
      packages/form-core/src/FieldApi.ts, packages/form-core/src/FormGroupApi.ts
      Field validation and related-field selection now use isFieldInGroup for dot- and bracket-delimited path matching.
      Regression coverage and release metadata
      packages/form-core/tests/FormGroupApi.spec.ts, .changeset/wild-donkeys-shave.md
      Tests confirm that step1Extra is not treated as a member of step1. A patch changeset records the behavior change.

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

      Merge Risk: ⚪ Minimal · up to 54170

      The 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

      Suggested reviewers: crutchcorn

      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main change to form group membership matching.
      Description check✅ PassedThe description includes the required change summary, completed checklist items, testing status, and release impact.
      Linked Issues check✅ PassedThe PR replaces both identified prefix checks, adds regression tests, and generates a changeset as required by issue #2337.
      Out of Scope Changes check✅ PassedAll changes are directly related to correcting form group membership boundaries and validating the fix.
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
      ✨ 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.
    2. View your CI Pipeline Execution ↗ for commit 54170a6c413d64b6ba509ca2834631843028b426

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded4m 13sView ↗
      nx run-many --target=build --exclude=examples/**✅ Succeeded40sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-08-17 05:54:44 UTC

    3. More templates

      @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@2338

      commit: 54170a6

    4. :warning: Please install the 'codecov app svg image' 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.
  • Sign in to join this conversation.