veevalidate async validation rejection not reflected in UI after initial mount
0 reputation · 23 Feb 2023, 07:38 UTC
veevalidate's validate() method runs validation on initial mount by default, which can introduce errors in controlled components before user interaction. Async validation rules return a Promise; when the promise rejects, the error is attached to the field's errorBag, but documentation does not specify whether the UI automatically reflects this state without an explicit re-validation trigger. This creates uncertainty for forms relying on real-time error display during initial load, especially when validateOnMount is enabled in v4. The interaction between promise rejection timing and the component's render cycle remains an open design question.
Does veevalidate automatically update the UI when an async validation promise rejects after initial mount, or is a manual re-validation required to surface the error? If manual re-validation is needed, what is the minimal composition API pattern to sync the errorBag state with the UI without a full form reset? How does validateOnMount=true interact with async rules that resolve after the component first renders, and does this affect error message formatting via mapErrors?