Replies: 1 comment 1 reply
-
I thought some of the behaviours you mentioned is a bug. But it is actually working as expected:
Conform utilize
This is because of how you set the default value: defaultValue: {
name: externalStore.name,
age: externalStore.age,
}, Conform will use the latest default value on reset and so it is resetting the age field to 50.
You can use
The defaultValue ( |
Beta Was this translation helpful? Give feedback.
-
Describe the bug and the expected behavior
There is an external store and I need to update the form field when value in the store changes. I have used
form.update
for this and found 3 things I consider weird or buggy behaviour. Or maybe I just dont understand something.Conform version
v1.1.0
Steps to Reproduce the Bug or Issue
form.update
, thegetInputProps()
now returns 2 more props: 'key' and 'defaultValue'. I found this because I got an errorA props object containing a "key" prop is being spread into JSX
conform/packages/conform-dom/form.ts
Line 437 in 59156d7
conform/packages/conform-dom/form.ts
Line 342 in 59156d7
form.update
.form.update(undefined)
it does not change the field value but for some reason makes the next reset to obey undefined?What browsers are you seeing the problem on?
Chrome
Screenshots or Videos
No response
Additional context
What I propose:
form.update(undefined)
works the same way as setting undefined to defaultValue (it basically clears the input)form.update()
does not change the default value of the field so thatform.reset()
sets the field to the initial default valueform.update()
probably should add thekey
prop to thegetInputProps
Beta Was this translation helpful? Give feedback.
All reactions