File tree 4 files changed +58
-1
lines changed
packages/drizzle/src/transform/write
4 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,7 @@ export const traverseFields = ({
363
363
existingLocales,
364
364
fieldPrefix,
365
365
fields : field . fields ,
366
+ forcedLocale,
366
367
locales,
367
368
numbers,
368
369
parentTableName,
Original file line number Diff line number Diff line change 1
- import type { CollectionConfig } from 'payload/types '
1
+ import type { CollectionConfig } from 'payload'
2
2
3
3
export const groupSlug = 'groups'
4
4
5
5
export const Group : CollectionConfig = {
6
6
slug : groupSlug ,
7
7
fields : [
8
+ {
9
+ name : 'groupLocalizedRow' ,
10
+ type : 'group' ,
11
+ localized : true ,
12
+ fields : [
13
+ {
14
+ type : 'row' ,
15
+ fields : [
16
+ {
17
+ name : 'text' ,
18
+ type : 'text' ,
19
+ } ,
20
+ ] ,
21
+ } ,
22
+ ] ,
23
+ } ,
8
24
{
9
25
name : 'groupLocalized' ,
10
26
type : 'group' ,
@@ -16,6 +32,7 @@ export const Group: CollectionConfig = {
16
32
] ,
17
33
localized : true ,
18
34
} ,
35
+
19
36
{
20
37
name : 'group' ,
21
38
type : 'group' ,
Original file line number Diff line number Diff line change @@ -1452,6 +1452,42 @@ describe('Localization', () => {
1452
1452
expect ( docEs . deep . blocks [ 0 ] . title ) . toBe ( 'hello es' )
1453
1453
} )
1454
1454
1455
+ it ( 'should create/updated/read localized group with row field' , async ( ) => {
1456
+ const doc = await payload . create ( {
1457
+ collection : 'groups' ,
1458
+ data : {
1459
+ groupLocalizedRow : {
1460
+ text : 'hello world' ,
1461
+ } ,
1462
+ } ,
1463
+ locale : 'en' ,
1464
+ } )
1465
+
1466
+ expect ( doc . groupLocalizedRow . text ) . toBe ( 'hello world' )
1467
+
1468
+ const docES = await payload . update ( {
1469
+ collection : 'groups' ,
1470
+ data : {
1471
+ groupLocalizedRow : {
1472
+ text : 'hola world or something' ,
1473
+ } ,
1474
+ } ,
1475
+ locale : 'es' ,
1476
+ id : doc . id ,
1477
+ } )
1478
+
1479
+ expect ( docES . groupLocalizedRow . text ) . toBe ( 'hola world or something' )
1480
+
1481
+ // check if docES didnt break EN
1482
+ const docEN = await payload . findByID ( { collection : 'groups' , id : doc . id , locale : 'en' } )
1483
+ expect ( docEN . groupLocalizedRow . text ) . toBe ( 'hello world' )
1484
+
1485
+ const all = await payload . findByID ( { collection : 'groups' , id : doc . id , locale : 'all' } )
1486
+
1487
+ expect ( all . groupLocalizedRow . en . text ) . toBe ( 'hello world' )
1488
+ expect ( all . groupLocalizedRow . es . text ) . toBe ( 'hola world or something' )
1489
+ } )
1490
+
1455
1491
it ( 'should properly create/update/read localized tab field' , async ( ) => {
1456
1492
const result = await payload . create ( {
1457
1493
collection : tabSlug ,
Original file line number Diff line number Diff line change @@ -402,6 +402,9 @@ export interface Group {
402
402
groupLocalized ?: {
403
403
title ?: string | null ;
404
404
} ;
405
+ groupLocalizedRow ?: {
406
+ text ?: string | null ;
407
+ } ;
405
408
group ?: {
406
409
title ?: string | null ;
407
410
} ;
You can’t perform that action at this time.
0 commit comments