Problem/Motivation
Duplicating a top-level Paragraph item that contains nested Paragraphs appears to create a new parent paragraph while reusing one or more existing nested child paragraph entities instead of deep-cloning the full descendant tree.
This causes two visible problems:
Editing side effects
After duplicating a top-level row paragraph, editing nested content in the duplicate also changes the original.
In a minimal test, duplicating a row containing a nested text paragraph and changing the duplicate from Row 1 to Row 2 caused the original row to also display Row 2.
Invalid exported content
When the content is exported as default content YAML, the same nested paragraph UUIDs are serialized multiple times under different parent rows.
Importing that YAML fails with duplicate UUID errors, for example:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'e8c04944-d8c7-4e6e-b36c-6180b329a976' for key 'paragraphs_item.paragraph_field__uuid__value'
Example from a minimal exported page:
two different top-level row paragraphs had unique UUIDs
but both rows contained the same nested paragraph UUIDs for:
one_column_layout
column_content
text
This suggests the duplication behavior is shallow for nested paragraph structures, and shared references are being created where independent child entities are expected.
Attached is the yaml file created with a default content export.
Steps to reproduce
- Create content with a Paragraph field that allows a top-level row paragraph.
-
Inside that row, add nested paragraphs, for example:
- one_column_layout
- column_content
- text
- Enter text such as Row 1 in the nested text paragraph.
- Duplicate the top-level row paragraph using the Paragraphs UI.
- Edit the duplicated row's nested text from Row 1 to Row 2.
- Save the content.
Observed Result
- The original row's nested text is also changed, indicating the duplicated row is sharing nested child paragraph entities with the original.
- Exporting the content to default content YAML shows repeated nested paragraph UUIDs under different top-level rows.
Importing that YAML fails due to duplicate paragraph UUID insertion.
Expected Result
- Duplicating a top-level paragraph should deep-clone all nested descendant paragraphs.
- Editing nested content inside the duplicate should not modify the original.
- Exported content should contain unique paragraph UUIDs for each duplicated nested paragraph instance.
Proposed resolution
When duplicating a Paragraph entity that contains nested Paragraph references, the duplication process should deep-clone the entire nested paragraph tree rather than reusing existing child paragraph entities.
More specifically:
duplicated parent paragraphs should receive newly created descendant paragraph entities
each duplicated nested paragraph should have its own UUID
no child paragraph entity should be shared between the original and duplicate unless explicit shared-reference behavior is intended
At minimum, duplication of nested paragraph structures should avoid producing shared child references that cause:
cross-editing between original and duplicate
repeated embedded paragraph UUIDs in exports
import failures in downstream systems
If helpful, I can also turn this into a more polished Drupal.org issue format with a title and a short technical summary.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| 05d47608-2a9b-4e06-9b54-714fc253275e.yml | 8.3 KB | shelane |
Comments
Comment #2
shelaneComment #3
shelaneComment #4
shelaneI noticed in the code:
So I installed the replicate module and it has the behavior I was looking for - no duplicate uuid values on export.
I'm not sure if this is intentional that the paragraph default is a reference clone and the replicate module does a deep clone. I will say that solves my issue if that is the intent. I'll leave this open if the maintainers want to comment on that.
Comment #5
shelaneI just saw a related issue, so I will close as a duplicate.
Comment #6
shelane