I'm stuck on this error on saving the field:
Cast to embedded failed for value "1" (type number) at path "erk" because of "ObjectParameterError"
We are working to make this easier, but in the meantime - this will likely help you:
https://github.com/payloadcms/payload/issues/2427#issuecomment-1512320542Thanks! Noticed this too late so ended up with this:
const toggle = useEvent(({ slug, title }: CourseMaterialTaxonomy['erk'][0]) => {
if (selectedSlugs.includes(slug)) {
dispatchFields({
type: 'REMOVE_ROW',
rowIndex: selectedSlugs.indexOf(slug),
path,
})
} else {
dispatchFields({
type: 'ADD_ROW',
rowIndex: selectedSlugs.length,
subFieldState: {
id: {
disableFormData: false,
valid: true,
initialValue: undefined,
value: slug,
},
slug: {
disableFormData: false,
valid: true,
initialValue: undefined,
value: slug,
passesCondition: true,
},
title: {
disableFormData: false,
valid: true,
initialValue: undefined,
value: title,
passesCondition: true,
},
},
path,
})
}
})
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.