Skip to content
Source
Sign inSign up
TanStack/form

fix(form-core): preserve validation counters across form reset #2385

Openlunaxislu(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/2385/headopened

Showing 4 changed files with 59 additions and 25 deletions (loading 1).

x
0 of 4 viewed, 4 left
5 additions and 0 deletions.changeset/tidy-validation-counters.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/form-core': patch
+---
+​
+Preserve field validation state across form resets by discarding stale work waiting for form validation and preventing older completions or debounce cancellations from decrementing current validation counters.
49 additions and 25 deletionspackages/form-core/src/FieldApi.tsModified
View file
@@ -706,6 +706,13 @@
formListeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>
​
+ private validationTimeouts: Partial<
+ Record<
+ ValidationCause,
+ { id: ReturnType<typeof setTimeout>; generation: number }
+ >
+ > = {}
+​
/**
* Initializes a new `FieldApi` instance.
@@ -1425,6 +1432,7 @@