mobx-react-form
mobx-react-form copied to clipboard
field.set(obj) doesn't update form.touched and form.changed
I have a field with an empty object as initial value. I'm using field.set
to dynamically add some new keys. It works good, but form properties (touched, changed) don't reflect these changes.
Also, could you provide some examples how to deal with Array and Object values? Current docs don't clarify this enough.
Right now the set()
method doesn't change other fields props.
I need to think more about how to handle this, as the set()
method doesn't handle specific behavior for each props right now.
About dealing with complex fields structure, did you take a look to the demo repo?
Same issue for me. form.set('changed', true)
as simple temporal fix is not allowed neither so for now there is not a way to change form state manually? (at least until we find a solution).
It feels rather intuitive that you need to call form.select(field).onUpdate(value)
to actually update a changed
flag. Took me quite some time to figure that out from source code :(
:tada: This issue has been resolved in version 5.8.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
From version 5.8 field set() will trigger onChange hook on ‘changed’ field prop increment.
‘touched’ prop is changed only if the user interact with inputs