I have a collection with an array field. The array items have a localized text field. E.g.:
{
name: 'items',
type: 'array',
fields: [
{
name: 'title',
type: 'text',
localized: true,
},
],
},
I want to create a new record via Local API with multiple array items and set the text in multiple languages. How can i do that?
I tried first creating the record in the first language and then updating it in the others like this:
const record = await payload.create({
collection: 'my-collection',
data: {
items: [
{
title: 'Item 1',
},
{
title: 'Item 2',
},
],
},
locale: 'en',
})
await payload.update({
collection: 'my-collection',
id: record.id,
data: {
items: [
{
title: 'Punkt 1',
},
{
title: 'Punkt 2',
},
],
},
locale: 'de',
})
But the update seems to completely replace the original items - leaving the english language title empty.