Skip to content

Cloning doesn't generate new id's for embedded elements #8185

@stevo-knievo

Description

@stevo-knievo

Describe the bug

When I clone a document via the CMS UI. The document gets a new ID (and a new version ID) but not the embedded elements, which are included via a bag content part.

To Reproduce
Steps to reproduce the behaviour:

  1. Create content-type: Bar
  2. On Add Parts To "Bar", add: Title
  3. Create a second content-type: Foo
  4. On Add Parts To "Foo", add: Bag, Title
  5. Edit that content-type "Foo": Edit Bag and select the "Bar" content-type at "Contained Content Types"
  6. Create a new content item from content-type: Foo, with a title and at least one Bar item
  7. Using the graphQL query below to query the just created a content item from content-type: Foo
  8. Clone the content just created a content item from content-type: Foo
  9. Using the same query to query both items

Expected behaviour
I was expecting that a clone content item has new ids for all embedded elements.

GraphQL query

query fooQuery {
  foo {
    contentType
    contentItemId
    contentItemVersionId
    displayText
    bag {
      contentItems {
        contentItemId
        contentType
        displayText
      }
    }
  }
}

Query result from the first created content item

{
  "data": {
    "foo": [
      {
        "contentType": "Foo",
        "contentItemId": "4afm7w6fcdddvv4jnh7bym6y5f",
        "contentItemVersionId": "4cezhk796c95avxmecs6yrcfm6",
        "displayText": "Test 1",
        "bag": {
          "contentItems": [
            {
              "contentItemId": "4v1zxrewd0k0cwqf2kxvx8mvma",
              "contentType": "Bar",
              "displayText": "Bar 1"
            }
          ]
        }
      }
    ]
  }
}

Query result with the clone content item

{
  "data": {
    "foo": [
      {
        "contentType": "Foo",
        "contentItemId": "47yyt8a4fsjv63w492tt1er5da",
        "contentItemVersionId": "4jn8r5wxypwte50m6g5qygtcnr",
        "displayText": "Test 1 Clone",
        "bag": {
          "contentItems": [
            {
              "contentItemId": "4v1zxrewd0k0cwqf2kxvx8mvma",
              "contentType": "Bar",
              "displayText": "Bar 1"
            }
          ]
        }
      },
      {
        "contentType": "Foo",
        "contentItemId": "4afm7w6fcdddvv4jnh7bym6y5f",
        "contentItemVersionId": "4cezhk796c95avxmecs6yrcfm6",
        "displayText": "Test 1",
        "bag": {
          "contentItems": [
            {
              "contentItemId": "4v1zxrewd0k0cwqf2kxvx8mvma", <-- same ID
              "contentType": "Bar",
              "displayText": "Bar 1"
            }
          ]
        }
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions