defaultValue support for block field config #10493
Replies: 1 comment
-
My previous remark has been somewhat mitigated in Payload v3.38.0 due to the addition of #12318 which Therefore, now the workaround for wrapping many fields inside a group field in order to provide a single large That said, eventually adding |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Block configs currently don't support a
defaultValueoption.It would be great if block configs behave more like the array field and support
defaultValueon the same level as thefieldsoption.The benefits of supporting
defaultValuein block config might not be immediately obvious in this reduced use-case scenario with only two simple text fields, asdefaultValuecan be added on each of the two text fields. However, this would become very useful ifblocks.fieldscontained some more complex nested fields (especially nested array fields). In that scenario,defaultValueon the block config level would provide a way to automatically start with a complex skeleton of multiple inserted fields whenever a new block is added by providing one largedefaultValuenested array.Currently, the workaround is to wrap all fields inside
blocks.fieldsin a group field, and then provide adefaultValuefor the group field. However, this adds another parent/level of nesting, which might be undesired.Beta Was this translation helpful? Give feedback.
All reactions