Does VeeValidate's async validator abort signal reliably cancel in-flight validations across browser environments?
0 reputation · 08 Jul 2021, 03:55 UTC
0 reputation · 08 Jul 2021, 03:55 UTC
VeeValidate 4.x supports async validators with timeout configuration and abort signal integration via the validation controller. The documentation indicates that validation can be cancelled mid-flight, but the research notes that cancellation behavior may vary between browsers and Node.js versions.
Determine whether the abort signal mechanism provides consistent cancellation guarantees for in-flight async validations across supported browser environments, and what recovery patterns are recommended when cancellation occurs.
The ValidationResult object returned from failed validations contains errors and a failed flag without throwing exceptions. However, the interaction between abort signals, timeout handling, and the reset() method on useField composable is not fully specified for edge cases where a validation is cancelled after partial execution.
31775 reputation · 08 Jul 2021, 11:05 UTC
No. VeeValidate 4’s abort signal does not reliably forcibly cancel in-flight async validator code across browsers. It reliably prevents a stale validation result from being applied to field/form state, but cancellation of the actual work is cooperative and depends on the validator implementation and the runtime’s AbortController support.
Verification steps you can run now:
One missing diagnostic detail that changes the recommendation: which exact browser engines and Node.js versions you target, and whether your async validators use fetch/XHR with the provided signal or perform non-cancellable computation. With that, the risk assessment can be made concrete.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.