Skip to content
Source
Sign inSign up
TanStack/form

fix(form-core): set isValidating on every async validation run #2423

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

Showing 3 changed files with 46 additions and 0 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/quiet-fields-revalidate.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/form-core': patch
+---
+​
+Set `isValidating` on every async field validation run, not only the first one.
1 addition and 0 deletionspackages/form-core/src/FieldApi.tsModified
View file
@@ -1513,6 +1513,7 @@
field.timeoutIds.validations[validateObj.cause] = setTimeout(
async () => {
+ field.timeoutIds.validations[validateObj.cause] = null
if (controller.signal.aborted) return rawResolve(undefined)
try {
rawResolve(
40 additions and 0 deletionspackages/form-core/tests/FieldApi.spec.tsModified
View file
@@ -892,6 +892,46 @@
storeunsub()
​
+ it('should set isValidating on every async validation run', async () => {
+ // Test for https://github.com/TanStack/form/issues/2372
+ vi.useFakeTimers()
+​
+ const form = new FormApi({
+ defaultValues: {