iway1 / react-ts-form

https://react-ts-form.com
MIT License
2.01k stars 33 forks source link

issue: error in Array schemas don't surface #126

Open bastibuck opened 1 year ago

bastibuck commented 1 year ago

Version Number

1.8.0

Codesandbox/Expo snack

https://codesandbox.io/s/react-ts-form-example-forked-38ykmt?file=/src/App.tsx

Steps to reproduce

  1. Click submit without checking a checkbox
  2. Data is being logged
  3. Check a checkbox, no error is still visible although the validation should fail (due to uuid())
  4. Click submit, data is not being logged

The issue is that errors coming from zod don't seem to surface into the error coming from useTsController(). The submit is disabled correctly but no error can be shown.

If you remove the uuid() part the submit works fine.

Expected behaviour

Array schema validation errors should also surface when using useTsController inside a field component.

Maybe I'm just doing something wrong but the codesandbox and my local solution provide just the same output where the error is never changed on actual falsy inputs.

Relevant log output

No response

bastibuck commented 1 year ago

PS: The errors returned from the RHF useForm is correct