- Issue created by @bkosborne
If you export a node that has an inline content block and then import that node, the block gets created twice on the import site. Everything works, but a duplicate block is created. The duplicate is not created as a revision of the original. Two distinct blocks are created. I consider this a bug because one block essentially becomes un-referenced by the page layout and just remains there like a ghost. There's no way to delete it without deleting the entire node, which could be a problem if you are doing things like tracking entity usage (via entity_usage module).
The reason this happens is because the LayoutSection field processor plugin manually imports the node & the attached inline blocks first. Then when the entity is saved again at the end of the import process, layout_builder_entity_presave
's logic determines that the blocks need to be duplicated and does so.
I spent a little time on this and got a bit lost in the Layout Builder code for saving the blocks. We either need to find a way to have layout builder not try duplicate the blocks that already exist, or we need to not manually create them ourselves.
Not manually creating them ourselves could mean that when exporting the inline block, we unset block_revision_id and instead serialize the block and store it in block_serialized. Then when don't need to do anything, layout builder will automatically unpack this and save the block entity and register usage of it. But the problem here is that we need the block entity to go through our import process, otherwise things like referenced media and taxonomy terms on the block won't get imported!
Needs work
1.4
Code