You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you were expecting:
When using a SelectArrayInput inside ArrayInput -> SimpleFormIterator -> FormDataConsumer, when removing an element from the ArrayInput (either by clicking the "Remove" button or the "Clear the list" button), and then adding a new element, the defaultValue for the SelectArrayInput is used for the new element.
What happened instead:
When doing the above, the SelectArrayInput of the new element is empty.
The underlying reason seems to be that the property for the SelectArrayInput is being set to null instead of removing it from the record, for some reason. SelectArrayInput has some special handling to ensure that the value always is an array, but it simply falls back to the empty array in this case. We ran into this problem with a custom component that works similar to SelectArrayInput, but didn't catch this, so our component actually crashed, because it received "" as value, instead of an array (the null seems to be converted to "" by the useInput hook).
What you were expecting:
When using a
SelectArrayInput
insideArrayInput -> SimpleFormIterator -> FormDataConsumer
, when removing an element from theArrayInput
(either by clicking the "Remove" button or the "Clear the list" button), and then adding a new element, thedefaultValue
for theSelectArrayInput
is used for the new element.What happened instead:
When doing the above, the
SelectArrayInput
of the new element is empty.The underlying reason seems to be that the property for the
SelectArrayInput
is being set tonull
instead of removing it from the record, for some reason.SelectArrayInput
has some special handling to ensure that the value always is an array, but it simply falls back to the empty array in this case. We ran into this problem with a custom component that works similar toSelectArrayInput
, but didn't catch this, so our component actually crashed, because it received""
asvalue
, instead of an array (thenull
seems to be converted to""
by theuseInput
hook).Steps to reproduce:
ArrayInput
labeled "Items".SelectArrayInput
(while it should have "Foo" selected).Environment
The text was updated successfully, but these errors were encountered: