Localized blocks inside localized blocks not working properly across multiple locales
Link to reproduction
No response
Payload Version
beta.87
Node Version
20 LTS
Next.js Version
15.0.0-canary.104
Describe the Bug
Blocks inside localized blocks are creating multiple content occurrences. Localized Blocks inside localized blocks cannot be migrated.
Here's the issue in detail
https://github.com/user-attachments/assets/c561e35d-7261-4b75-ae34-529931d5068c
To test this, created 2 blocks (BlockInsideBlock and MediaBlock)
MediaBlock
export const MediaBlock: Block = {
slug: 'media',
interfaceName: 'MediaBlock',
labels: {
singular: 'Media Block',
plural: 'Media Blocks',
},
fields: [
{
name: 'media',
label: 'Media',
type: 'upload',
relationTo: 'media',
required: true,
},
],
}
BlockInsideBlock
export const BlockInsideBlock: Block = {
slug: 'blockInsideBlock',
interfaceName: 'BlockInsideBlock',
fields: [
{
name: 'content',
label: 'Block',
type: 'blocks',
// localized: true,
labels: {
singular: 'Block',
plural: 'Blocks',
},
blocks: [MediaBlock],
},
],
}
I then added a localized blocks field with the BlockInsideBlock to the existing fields of the Pages collection.
{
name: 'content',
label: 'Content',
type: 'blocks',
localized: true,
blocks: [BlockInsideBlock],
},
Since the Media content was the same between the EN and FR locales, I tried to add localization to the content field in the BlockInsideBlock (currently commented), but I always get the error ERROR (payload): Error: cannot connect to Postgres. Details: Cannot read properties of undefined (reading 'Symbol(drizzle:Name)') when creating the migrations.
Is there any current restrictions in the use of blocks inside blocks that could be causing the migrate:create command to fail with this error message? Or for the duplication of content for blocks inside blocks?
Reproduction Steps
- Use the beta demo project
- Update to version 87
- Create the
MediaBlockand theBlockInsideBlock - Add the new Page field (as described above) to the existing Page fields
- Run the necessary migrations
- Follow the same steps as the ones in the video to check that the content in the block inside the block keeps multiplying every time the page autosaves or if another locale is configured.
- Remove the comment from the
BlockInsideBlockand make that field localized - Run the migrate:create command and see that the error
ERROR (payload): Error: cannot connect to Postgres. Details: Cannot read properties of undefined (reading 'Symbol(drizzle:Name)')is presented
Adapters and Plugins
db-postgres