payload icon indicating copy to clipboard operation
payload copied to clipboard

(db-postgres): localized group and localized fields inside of group are broken.

Open r1tsuu opened this issue 1 year ago • 1 comments

Link to reproduction

https://github.com/r1tsuu/payload/tree/postgres-reproduction

Describe the Bug

Given the collection config:

import type { CollectionConfig } from 'payload/types'

export const localizedSlug = 'localized '

export const Localized: CollectionConfig = {
  slug: localizedSlug,
  fields: [
    {
      name: 'groupLocalized',
      localized: true,
      type: 'group',
      fields: [
        {
          name: 'title',
          type: 'text',
        },
      ],
    },
    {
      name: 'group',
      type: 'group',
      fields: [
        {
          localized: true,
          name: 'title',
          type: 'text',
        },
      ],
    },
  ],
}

In both cases (localized inside and localized group itself) data is not saved to the database for properly, from my integration test i have this (null data for last row with en locale): image In the admin ui it just shows you the data in wrong language

Found this while was writing integration test for my PR https://github.com/payloadcms/payload/pull/5942

To Reproduce

Run pnpm test int:postgres _community - doesnt pass pnpm test int _community - passes with mongodb, which should confirm that something is wrong.

Payload Version

2 and 3

Adapters and Plugins

db-postgres

r1tsuu avatar Apr 25 '24 13:04 r1tsuu

i think i could handle it, can assign to me

r1tsuu avatar Apr 25 '24 21:04 r1tsuu

Any progress on this issue? We just ran into this problem as well.

sebastianpulak avatar Jul 04 '24 10:07 sebastianpulak

Any progress on this issue? We just ran into this problem as well.

I opened a PR https://github.com/payloadcms/payload/pull/6158

r1tsuu avatar Jul 04 '24 16:07 r1tsuu

The PR looks great! Good work @r1tsuu, are you able to resolve the merge conflict and we'll take it from there? We should be able to get this merged and ready for the next release.

DanRibbens avatar Jul 08 '24 19:07 DanRibbens

I am closing this. It will be out in the next release of 3.0 beta.

I may do a backport of all the database changes made in beta back to 2.x based on demand.

Thanks @r1tsuu for this fix.

DanRibbens avatar Jul 24 '24 17:07 DanRibbens

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Sep 07 '24 00:09 github-actions[bot]