fix(drizzle): array/relationship/select hasMany in localized field (#8355)

This PR addresses these issues with localized groups / tabs with
Postgres / SQLite:

- Array fields inside of localized groups. Fixes
https://github.com/payloadcms/payload/issues/8322
- Select fields with `hasMany: true` inside of localized groups. Related
to 1, but still needed its own additional logic.
- Relationship (non-polymorphic / non has-many) inside of localized
groups. Previously, even just trying to define them in the config led to
a crash. Fixes https://github.com/payloadcms/payload/issues/8308

Ensures test coverage for localized groups.
This commit is contained in:
Sasha
2024-09-23 18:34:02 +03:00
committed by GitHub
parent 36ba6d47b4
commit 338c93a229
6 changed files with 192 additions and 3 deletions

View File

@@ -879,7 +879,7 @@ export const traverseFields = ({
// add relationship to table
relationsToBuild.set(fieldName, {
type: 'one',
localized: adapter.payload.config.localization && field.localized,
localized: adapter.payload.config.localization && (field.localized || forceLocalized),
target: tableName,
})