r1tsuu/payload-enchants

Issues with nested block IDs

lynndylanhurley opened this issue · 1 comments

When copying collections with several layers of nesting, the IDs of the children are getting copied as well, which results in the following error:

 ERROR: TypeError: Cannot read properties of undefined (reading 'pages_blocks_accordion_block_items_pkey')

In this case the structure looks like this:

  • Page (collection)
    • Block (array)
      • Accordion (array)
        • Item (object)

It seems like the IDs for everything are getting pulled in from the original doc, and payload adds unique constraints for the block and collection ids. For example, a block within one page can't share an ID with a block in another collection.

Just opened a PR that resolved this for my project.