-
-
Notifications
You must be signed in to change notification settings - Fork 512
Description
Describe the bug
When we use withFieldGroup and a value of the group/form is an object
const MyGroup = withFieldGroup({
defaultValues: {
complexValue: {
prop1: 0,
prop2: 0
}
},
...
})
and then we use this group somewhere like this, assuming form contains a value "complexValue"
<MyGroup
form={form}
fields={{
complexValue: "complexValue",
}}
/>
then the internally created mapping by
form/packages/form-core/src/FieldGroupApi.ts
Line 143 in a6abf35
getFormFieldName = <TField extends DeepKeys<TFieldGroupData>>( |
is wrong, because the combination of the following code line, which keeps a leading dot from the accessor path
e.g. "complexValue.prop1"
results in ".prop1"
here.
form/packages/form-core/src/FieldGroupApi.ts
Line 156 in a6abf35
const restOfPath = subfield.slice(firstAccessor.length) |
and then later this line
form/packages/form-core/src/utils.ts
Line 199 in a6abf35
return `${path1}.${path2}` |
result in a path with two dots in it.
E.g. "complexValue.prop1"
ist getting mapped to "complexValue..prop1"
Your minimal, reproducible example
I have none
Steps to reproduce
I hope my description of the bug and the root cause should be enough information to easily track it down and/or reproduce it.
Expected behavior
Correct mappings should get generated by getFormFieldName
.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser: Edge
- Version: 138.0.3351.95
TanStack Form adapter
None
TanStack Form version
v1.15.0
TypeScript version
No response
Additional context
No response