-
-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
Version Number
5.2.1
Codesandbox/Expo snack
https://stackblitz.com/edit/vitejs-vite-cntkt5yv?file=README.md
Steps to reproduce
- Read the readme of the stackblitz
- Focus the input in the preview and press enter
- The error is shown as "Invalid host or port"
Expected behaviour
My schema is a union, which has an error handler in order to decide what to show based on the errors of the constituent schemas. I expected the error message returned by my union to be used in the form, but instead the first error from the first schema in the union is used instead, due to this line:
Line 95 in 49a0d7b
| const unionError = error.errors[0][0]; |
Now that error handlers are only per-schema (see colinhacks/zod#4893 (comment)), I'm not sure how else to accomplish what I'm trying to do, which is to validate a single input field which can accept either an IPv4 address with a port, an IPv6 address with a port, or an empty string.
What browsers are you seeing the problem on?
No response
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
bjungs
Metadata
Metadata
Assignees
Labels
No labels