fix(form-core): fix stale async validators from updating isValidating to false#2047
Open
AdrianLea wants to merge 3 commits intoTanStack:mainfrom
Open
fix(form-core): fix stale async validators from updating isValidating to false#2047AdrianLea wants to merge 3 commits intoTanStack:mainfrom
AdrianLea wants to merge 3 commits intoTanStack:mainfrom
Conversation
added 3 commits
February 18, 2026 13:13
…nt supersession false positive on submit
…nt supersession false positive on submit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #2045
🎯 Changes
Two bugs fixed in
validateAsyncwithinFieldApi.ts:1. Abort controller stored on the wrong field
validateFieldAsyncFnis called for both the main field and linked fields, but always wrote the newAbortControllertothis.getInfo()instead offield.getInfo(). This was a copy-paste oversight — the read side already usedfield.getInfo()correctly, but the write side was never updated when linked field support was added. This meant:linkedField.getInfo().validationMetaMap[errorMapKey]?.lastAbortController.abort(), the entry was alwaysundefined— linked fields' async validators were silently never cancelled2. No supersession check —
isValidatingunconditionally clearedAfter all async promises resolved, the original code was:
This unconditionally cleared
isValidatingon every field regardless of whether a newer async validation run had started in the meantime, causing a stale run to clobber theisValidatingstate of an in-progress one.Fix:
field.getInfo()instead ofthis.getInfo()AbortSignalto(field, errorMapKey)and check if the currentAbortSignalis still the latest for that specific field and key before clearingisValidating, so a stale run completing can't prematurely reset a newer run's validating state✅ Checklist
pnpm test:pr.🚀 Release Impact