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:

  1. Go to https://stackblitz.com/edit/vitejs-vite-dwvjn3?file=src/App.jsx
  2. See that isValid is false but errors 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)

Most upvoted comments

Any update on this?

validating the schema, the errors aren’t being cleared after applying to a registered input (probably a separate issue)

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.

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 the isValid property is reporting invalid.

validating the schema, the errors aren’t being cleared after applying to a registered input (probably a separate issue)

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.