You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a field named fieldConfiguration.inputConfiguration.options, It's validation schema check that there should be atleast two objects in the array. If there is no field added then it showing correct field error "Array must contain at least 2 element(s)" , but when I add one field, it shows "undefined".
Screenshots
No Field added
One Field added
Solution
I have checked the logs by putting console.log inside the component FormMessage, I think when I am getting "undefined" error message then in the Error Object there is no message key. I have attached the logs below.
I would like to Make Pull request for this FIX.
Replace code:
const body = error ? String(error?.message) : children;
With this one:
const body = error ? String(error?.message || error?.root?.message) : children;
Describe the bug
I have a field named fieldConfiguration.inputConfiguration.options, It's validation schema check that there should be atleast two objects in the array. If there is no field added then it showing correct field error "Array must contain at least 2 element(s)" , but when I add one field, it shows "undefined".
Screenshots
Solution
I have checked the logs by putting console.log inside the component
FormMessage
, I think when I am getting "undefined" error message then in the Error Object there is nomessage
key. I have attached the logs below.I would like to Make Pull request for this FIX.
Replace code:
With this one:
Affected component/components
Form ->
How to reproduce
Try to use below code
Validation Schema:
Next.js Code:
Codesandbox/StackBlitz link
No response
Logs
No Feild error:
{
"error": {
"message": "Array must contain at least 2 element(s)",
"type": "too_small",
"ref": {
"name": "fieldConfiguration.inputConfiguration.options"
}
}
}
One Field Error:
{
"error": {
"root": {
"message": "Array must contain at least 2 element(s)",
"type": "too_small",
"ref": {
"name": "fieldConfiguration.inputConfiguration.options"
}
}
}
}
Before submitting
The text was updated successfully, but these errors were encountered: