File still adds even if yup validation fails
I'd like to block adding the file if Yup validation fails. In this case, field.state.value still gets set even if the size is too large.
Using v0.13.0 for React-Form and Form-Core.


3 Replies
conscious-sapphire•2y ago
Huh... I don't know why that would be failing. Are you sure that Yup is failing explicitly?
If ya are, let's open a GH issue with a minimal repro and we'll investigate 🙂
afraid-scarletOP•2y ago
Thanks, I will try to repro on a minimal environment and see. As a manual fix I was able to solve it by running
.validateSync
on the event in the handler, and if it fails validation, it will return out of adding the file to the event and simply return the validation message instead. Otherwise, if it passes validation, it will add the file properly.conscious-sapphire•2y ago
Oh! Did you add the ZodValidator adapter?