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

Showing 4 changed files with 7 additions and 2 deletions (loading 1).

x
0 of 4 viewed, 4 left
5 additions and 0 deletions.changeset/wild-donkeys-shave.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/form-core': patch
+---
+​
+Restrict form group membership to dot- and bracket-delimited field paths so fields that merely share a name prefix with a group are no longer treated as part of it.
1 addition and 1 deletionpackages/form-core/src/FieldApi.tsModified
View file
@@ -1628,7 +1628,7 @@
const encompassingGroups = opts?.skipGroupValidation
: Array.from(this.form.formGroupApis).filter((group) =>
- this.name.startsWith(group.name),
+ isFieldInGroup(group.name, this.name),
// Attempt to sync validate first
1 addition and 1 deletionpackages/form-core/src/FormGroupApi.tsModified
View file
@@ -1646,7 +1646,7 @@
if (!field.instance) continue