-
-
Notifications
You must be signed in to change notification settings - Fork 589
Closed
Description
Describe the bug
When having a form field that is an object, the field's meta errors array is empty, but the form errors array is not.
The form errors look like this:
[
{
"user.id": [
{
"code": "too_small",
"minimum": 3,
"type": "string",
"inclusive": true,
"exact": false,
"message": "[Zod] Id requires 3 characters",
"path": ["user", "id"]
}
],
"user.username": [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": ["user", "username"],
"message": "Expected string, received null"
}
]
}
]Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-va6wcbbw?file=src%2Findex.tsx
Steps to reproduce
- Create a form with an object as a field
- Try accessing the field errors
- Access the form errors
- See the differences
Expected behavior
The field's errors array should not be empty and instead include the errors with each property of the object
I think the field's error array should look either like this:
[
{
"user": [
{
"id": [
{
"code": "too_small",
"minimum": 3,
"type": "string",
"inclusive": true,
"exact": false,
"message": "[Zod] Id requires 3 characters",
"path": ["user", "id"]
}
]
},
{
"username": [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": ["user", "username"],
"message": "Expected string, received null"
}
]
}
]
}
]or like this:
[
{
"user": {
"id": [
{
"code": "too_small",
"minimum": 3,
"type": "string",
"inclusive": true,
"exact": false,
"message": "[Zod] Id requires 3 characters",
"path": ["user", "id"]
}
],
"username": [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": ["user", "username"],
"message": "Expected string, received null"
}
]
}
}
]How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
All
TanStack Form adapter
react-form
TanStack Form version
1.1.2
TypeScript version
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels