Describe the bug#
A form-level onChangeAsync Standard Schema validator can apply a stale result after a newer validation has aborted it.
When a new async validation starts, TanStack Form aborts the previous validation's AbortController. However, Standard Schema validators receive the value rather than TanStack Form's AbortSignal.
A Zod async refinement therefore cannot observe the cancellation and may continue running.
After the older validator resolves, TanStack Form applies its result without checking the signal again. The stale result can consequently restore an error after a newer validation has already
accepted the current value.
This is related to #1457, but this reproduction uses only one form-level async Standard Schema validator. It does not combine synchronous and asynchronous validators.
Tested with:
@tanstack/react-form 1.33.5
@tanstack/form-core 1.33.5, installed by @tanstack/react-form
- Zod 4.4.3
Your minimal, reproducible example#
https://stackblitz.com/edit/vitejs-vite-gep72csm?file=src%2FApp.tsx
Steps to reproduce#
- Open the reproduction.
- Click Reproduce once. The example automatically starts a delayed validation for slow-invalid, changes the value to valid, and then lets the older validation finish.
- Confirm that the current field value is valid.
- Observe that the field nevertheless contains Stale validation result from the previous slow-invalid value.
- Reload the page to repeat the reproduction; the button is deliberately disabled after the first run.
Expected behavior#
The newer validation for valid aborts the pending validation for slow-invalid. When the older validation eventually finishes, its result should be ignored.
The current value should remain valid, and the field should have no validation errors.
How often does this bug happen?#
None
Screenshots or Videos#
No response
Platform#
- OS: Windows
- Browser: FF 153.0.3
TanStack Form adapter#
None
TanStack Form version#
1.33.5
TypeScript version#
6.0.2
Additional context#
No response