Skip to content

Commit

Permalink
fix(db-postgres): localized array inside blocks field (#7458)
Browse files Browse the repository at this point in the history
fixes #5240
Copy of #7457
  • Loading branch information
DanRibbens committed Jul 31, 2024
1 parent 492ed30 commit a308d63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/db-postgres/src/utilities/hasLocalesTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { fieldAffectsData, fieldHasSubFields } from 'payload/types'

export const hasLocalesTable = (fields: Field[]): boolean => {
return fields.some((field) => {
// arrays always get a separate table
if (field.type === 'array') return false
if (fieldAffectsData(field) && field.localized) return true
if (fieldHasSubFields(field) && field.type !== 'array') return hasLocalesTable(field.fields)
if (fieldHasSubFields(field)) return hasLocalesTable(field.fields)
if (field.type === 'tabs') return field.tabs.some((tab) => hasLocalesTable(tab.fields))
return false
})
Expand Down

0 comments on commit a308d63

Please sign in to comment.