#Default value on array fields

4 messages · Page 1 of 1 (latest)

green granite
#

Hello,

I noticed since v11.6.32 that array field generated types changed.

It was not giving an optional value before when defaultValue was set and required was false, now it returns an optional value even though a default value is set.

This is currently breaking a lot of my project code as I used to create a lot of arrays and blocks with default values.

When I add required to the field, I don't seem to be able to create documents without the required value even though a default is set.

defaultValue: [],
required: true,
minRows: 0,

Any suggestion about this?

green granite
#

Update: I rollbacked to v1.6.18 to fix the issue, v1.6.19 seems to introduce the issue

green granite
#

Found a solution:

{
  defaultValue: [],
  required: true,
  minRows: 0,
  validate: () => true,
}

Nonetheless, I don't think minRows: 0 should be ignored, might be a bug.

visual ginkgo
#

Hi @green granite this is definitely strange, are you still seeing this behavior on version 1.11.1 (latest)?