Replies: 7 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
why is that? |
Beta Was this translation helpful? Give feedback.
-
My thoughts as well. I'm skeptical of this behavior for the same reason you are, but that's how it work(ed) with |
Beta Was this translation helpful? Give feedback.
-
I think there is subtle difference in
Overall, I think we want to move aways with partial I am sure the issue is caused by the fixed which you have pointed above, and i think the work around is there so probably wont' spend time to find hacky solution for this. |
Beta Was this translation helpful? Give feedback.
-
I feel like there's a bit more to
I've had this on my mind for some time now and I believe it can be the right direction, but I anticipate a lot of push back, which.. I mean, the devs who utilize the partial nature of |
Beta Was this translation helpful? Give feedback.
-
I couldn't agree more... |
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 I (respectfully) disagree. If I add another input, say a text input, then its value will be added to the formData, although I did not declare it in the form's For instance if I add a const { field } = useController({
name: `baz`,
defaultValue: "default"
});
Even if I don't specify a default value, the field will be added to the formData: const { field } = useController({
name: `baz`,
// defaultValue: "default"
});
See for yourself: https://codesandbox.io/s/calc-forked-vtmgcq?file=/src/App.tsx So IMHO it's not illogical to have |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.46.0
Codesandbox/Expo snack
https://codesandbox.io/s/calc-forked-73klv5?file=/src/App.tsx
Steps to reproduce
{foo: "bar"}
, although we would have expected{foo: "bar", cart: Array(0)}
package.json
to use version7.44.0
or lower{foo: "bar", cart: Array(0)}
, as expectedExpected behaviour
I would have expected that providing
values
touseForm
would not override the value of my array field.Indeed if you remove the
values
, or usedefaultValues
instead, then the value for "cart" is no longer cleared (i.e. it's equal to[]
instead ofundefined
).This change seems to have occurred somewhere between version 7.44 and 7.45, according to my tests.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions