Prerequisites
What theme are you using?
other
Version
6.6.2
Current Behavior
While updating from 5.x to 6.x, I noticed changed behavior with the default form state for arrays.
In 5.24.13 array fields were always initialized with an empty array.
In 6.6.2 this no longer is the case.
The only hint I could find that this change was intentional, is in #4798
Updated getDefaultFormState to fix an issue where optional array props had their default set to an empty array when they shouldn't be
Furthermore, I noticed that setting experimental_defaultFormStateBehavior.arrayMinItems.populate to never, will restore the previous behavior of always defaulting to an empty array. This seems inconsistent to me.
Expected Behavior
Since, this change is not properly documented in the upgrade guide for 6.x, I'd like some clarification on the intended behavior here.
If the expected behavior is to keep arrays unset by default, I would love to have a config option to control this behavior.
Steps To Reproduce
Here are two sandboxes, demonstrating the behavior in 5.x and 6.x:
Environment
- OS: Ubuntu 22.04
- Node: 24.14.0
- pnpm: 11.9.0
Anything else?
No response
Prerequisites
What theme are you using?
other
Version
6.6.2
Current Behavior
While updating from 5.x to 6.x, I noticed changed behavior with the default form state for arrays.
In 5.24.13 array fields were always initialized with an empty array.
In 6.6.2 this no longer is the case.
The only hint I could find that this change was intentional, is in #4798
Furthermore, I noticed that setting
experimental_defaultFormStateBehavior.arrayMinItems.populatetonever, will restore the previous behavior of always defaulting to an empty array. This seems inconsistent to me.Expected Behavior
Since, this change is not properly documented in the upgrade guide for 6.x, I'd like some clarification on the intended behavior here.
If the expected behavior is to keep arrays unset by default, I would love to have a config option to control this behavior.
Steps To Reproduce
Here are two sandboxes, demonstrating the behavior in 5.x and 6.x:
Environment
Anything else?
No response