Instantiating a `FieldArray` with a default `Field.input` breaks the form when adding new elements to `FieldArray` and making subseqeunt `filed.actions.set()` calls on those field elements. #4
When instantiating a Form FieldArray with ~init=some([Field.input]), the first FieldArray element can be updated as expected however subsequent elements added to the FieldArray do not honor their field.actions.set() updates. Store values are not set on the form as expected.
Reproduction
module LoginArray = {
module Field = FieldArray.Make(
Login.Field,
{
type t = Login.Field.t
let filter = FieldArray.filterIdentity
},
)
let validate = (out: Field.output) => {
if out->Array.length < 2 {
Error("Must choose at least two logins")
} else {
Ok()
}
->Promise.return
->Promise.delay(~ms=1000)
}
let contextDefault: Field.context = {
validate,
empty: _ => [{username: "", password: ""}],
element: Login.contextValidate,
}
The VDO below shows that the second form element of the FieldArray not been updated as expected.
Bug
When instantiating a Form
FieldArray
with~init=some([Field.input])
, the first FieldArray element can be updated as expected however subsequent elements added to theFieldArray
do not honor theirfield.actions.set()
updates. Store values are not set on the form as expected.Reproduction
The VDO below shows that the second form element of the
FieldArray
not been updated as expected.https://github.com/user-attachments/assets/9574bf72-c251-4f03-be26-e6eaf97a979e
Gotchas
empty: _ => []
and/orempty: _ => [{username: "", password: ""}]
FieldArray
will not propagate it's changes to the form as expectedhttps://github.com/user-attachments/assets/a80f3fd9-a512-4330-ac8f-af6a1268de8c
Expected Behavior
FieldArray
should update when it'sfield.actions.set(value)
is called.