resolvers: zod's superRefine not working properly
Describe the bug
I want to use zod’s superRefine
validation function. hook form shows that form is invalid, but errors
object is empty
To Reproduce Steps to reproduce the behavior:
- Go to https://stackblitz.com/edit/vitejs-vite-dwvjn3?file=src/App.jsx
- See that
isValid
isfalse
buterrors
object is empty
Codesandbox link (Required) https://stackblitz.com/edit/vitejs-vite-dwvjn3?file=src/App.jsx
Expected behavior
error
object should have Block is too short
error message
Desktop (please complete the following information):
- OS: macOS Ventura 13
- Browser Chrome
- Version 111
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 9
- Comments: 27 (10 by maintainers)
Any update on this?
That’s fair, I will come up with a workaround for that.
I will note though, that the
isValid
property still shows invalid even though there are no errors since Zod reports errors but they don’t exist within the fields. I would expect that the errors object would have something if theisValid
property is reporting invalid.A separate issue, hook form is field level based for validation and consistent validation strategy. I don’t have a solution in my head without re-render the entre form on each form state.