How to handle require types when user deletes input #4990
Unanswered
jack-allocate
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've made a set of component wrappers for
useForm
,defineField
, etc.I have a schema like:
The number input component sets the input value to
undefined
when the input is emptied. This means that the form value is now:The problem here is now it triggers an undesirable error "Invalid type: Expected number but received undefined".
The obvious fix to me is to delete the age key entirely instead of setting it to undefined, which would then trigger the
required
validation. I haven't found any way of doing this in the docs/existing issues.Beta Was this translation helpful? Give feedback.
All reactions