diff --git a/packages/drizzle/src/transform/write/traverseFields.ts b/packages/drizzle/src/transform/write/traverseFields.ts index dd3ba349e59..6834c1184bd 100644 --- a/packages/drizzle/src/transform/write/traverseFields.ts +++ b/packages/drizzle/src/transform/write/traverseFields.ts @@ -363,6 +363,7 @@ export const traverseFields = ({ existingLocales, fieldPrefix, fields: field.fields, + forcedLocale, locales, numbers, parentTableName, diff --git a/test/localization/collections/Group/index.ts b/test/localization/collections/Group/index.ts index 47caceda872..d33fb5c4bb6 100644 --- a/test/localization/collections/Group/index.ts +++ b/test/localization/collections/Group/index.ts @@ -1,10 +1,26 @@ -import type { CollectionConfig } from 'payload/types' +import type { CollectionConfig } from 'payload' export const groupSlug = 'groups' export const Group: CollectionConfig = { slug: groupSlug, fields: [ + { + name: 'groupLocalizedRow', + type: 'group', + localized: true, + fields: [ + { + type: 'row', + fields: [ + { + name: 'text', + type: 'text', + }, + ], + }, + ], + }, { name: 'groupLocalized', type: 'group', @@ -16,6 +32,7 @@ export const Group: CollectionConfig = { ], localized: true, }, + { name: 'group', type: 'group', diff --git a/test/localization/int.spec.ts b/test/localization/int.spec.ts index 3c2c1cb0326..4598952664a 100644 --- a/test/localization/int.spec.ts +++ b/test/localization/int.spec.ts @@ -1452,6 +1452,42 @@ describe('Localization', () => { expect(docEs.deep.blocks[0].title).toBe('hello es') }) + it('should create/updated/read localized group with row field', async () => { + const doc = await payload.create({ + collection: 'groups', + data: { + groupLocalizedRow: { + text: 'hello world', + }, + }, + locale: 'en', + }) + + expect(doc.groupLocalizedRow.text).toBe('hello world') + + const docES = await payload.update({ + collection: 'groups', + data: { + groupLocalizedRow: { + text: 'hola world or something', + }, + }, + locale: 'es', + id: doc.id, + }) + + expect(docES.groupLocalizedRow.text).toBe('hola world or something') + + // check if docES didnt break EN + const docEN = await payload.findByID({ collection: 'groups', id: doc.id, locale: 'en' }) + expect(docEN.groupLocalizedRow.text).toBe('hello world') + + const all = await payload.findByID({ collection: 'groups', id: doc.id, locale: 'all' }) + + expect(all.groupLocalizedRow.en.text).toBe('hello world') + expect(all.groupLocalizedRow.es.text).toBe('hola world or something') + }) + it('should properly create/update/read localized tab field', async () => { const result = await payload.create({ collection: tabSlug, diff --git a/test/localization/payload-types.ts b/test/localization/payload-types.ts index ef01c5059b8..07df3c3d944 100644 --- a/test/localization/payload-types.ts +++ b/test/localization/payload-types.ts @@ -402,6 +402,9 @@ export interface Group { groupLocalized?: { title?: string | null; }; + groupLocalizedRow?: { + text?: string | null; + }; group?: { title?: string | null; };