Skip to content
Source
Sign inSign up
TanStack/form

fix(form-core): [v2] revalidate existing child fields when a parent value is set #2438

Openkkatalz(GitHub profile, opens in a new tab)wants to merge 1 commit intoalpha fromrefs/pull/2438/headopened

Showing 9 changed files with 34 additions and 1 deletion (loading 6).

x
0 of 9 viewed, 9 left
5 additions and 0 deletions.changeset/revalidate-child-fields.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/form-core': patch
+---
+​
+Revalidate existing child fields when a parent value is set, and clear their submit, server and mount errors.
1 addition and 1 deletionpackages/form-core/src/FieldApi/FieldApi.lib.tsModified
View file
@@ -965,7 +965,7 @@
_notifyEvent(
options: Omit<
ResolvedInternalFieldUpdateOptions,
- 'fieldApiOverride' | '_skipFieldCreation'
+ 'fieldApiOverride' | '_skipFieldCreation' | '_skipDescendantValidation'
event: 'change' | 'blur' | 'submit',
): void {
28 additions and 0 deletionspackages/form-core/src/FormApi/FormApi.lib.tsModified
View file
@@ -507,6 +507,7 @@
updateOptions.fieldApiOverride = field
​
batch(() => {
+ const previousValues = this._atoms.values.get()
const previousValue = this.getFieldValue(fieldName)
const nextValue = callUpdater(updater, previousValue)
const replacedSameLengthArray =