Hello, i am having trouble with collection fields, when i add "select" type to my collection inside array i get this cast to embedded error, does anyone know what am i doing wrong here or is it a bug in payload version 2.0?
{
name: 'link',
type: 'group',
fields: [
{
name: 'type',
type: 'select',
defaultValue: 'BUTTON',
options: ['BUTTON', 'LINK'],
},
]
}
here is my full config:
export const Pages: CollectionConfig = {
slug: 'pages',
admin: {
useAsTitle: 'title',
defaultColumns: ['title', 'slug', 'updatedAt'],
preview: (doc) =>
${process.env.PAYLOAD_PUBLIC_SITE_URL}/api/preview?url=${formatAppURL({ doc })}
,
},
hooks: {
beforeChange: [populatePublishedDate],
afterRead: [],
afterChange: [],
},
versions: false,
access: {
read: adminsOrPublished,
update: admins,
create: admins,
delete: admins,
},
fields: [
{
name: 'title',
type: 'text',
localized: true,
required: true,
},
{
name: 'columns',
type: 'select',
required: true,
options: [
{
label: '1',
value: '1',
},
{
label: '2',
value: '2',
},
{
label: '3',
value: '3',
},
{
label: '4',
value: '4',
},
],
},
{
name: 'event',
type: 'array',
fields: [
{
name: 'title',
type: 'text',
localized: true,
},
{
name: 'description',
type: 'text',
localized: true,
},
{
name: 'image',
type: 'upload',
relationTo: 'media',
},
{
name: 'link',
type: 'group',
fields: [
{
name: 'type',
type: 'select',
defaultValue: 'BUTTON',
options: ['BUTTON', 'LINK'],
},
]
}
]
},
{
name: 'publishedDate',
type: 'date',
admin: {
position: 'sidebar',
},
},
slugField(),
],
}
;
seems like updating to 2.0.9 fixed this for me
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.