Inline blocks are not saved after being cloned

Created on 13 March 2024, about 1 year ago

Problem/Motivation

When saving a section or template to the library, inline blocks are cloned during the process, but that duplicate is not saved to the database.

Steps to reproduce

Add a section to your page, add a custom block to it (our block is only a title and a wysiwyg, no entity reference).
Save that page, then go back in it, and add the section to your section library.
It will save properly, and you can add the template back in your page.
But if you look at the actual data in the database, you'll noticed that no new block were created.
You can see the issue by looking at the serialized version of the data. The block will have a different UUID.

This breaks when trying to use Section Library with Entity Share, as Entity Share will try to find a block that doesn't exists.

Proposed resolution

When digging in this, I saw that the clone seemed to improperly update the entity values. Also, the UUID key of the SectionComponent config isn,t set properly.

Remaining tasks

- Understand why the clone carries a different UUID in values and fields
- Figure out why the duplicated block isn't saved to the database.

πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada arakwar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @arakwar
  • πŸ‡ΊπŸ‡ΈUnited States jastraat

    This is still happening with 1.2.x
    However, I'm not sure how much of a true issue it is if the templates themselves do not contain "true" blocks because they are saved as true blocks within a layout once used.

    The only issue I found was if you created a template with a block that contained a file field (e.g. a direct image field) and you deleted all content that referenced that file, there doesn't appear to be an entry in the file_usage table associated with the template so the file is removed. This wasn't a problem with media or other entity references or paragraphs as long as the fix in πŸ› Error after importing section/template that contains blocks with paragraphs without available source content Active was present.

  • πŸ‡ΊπŸ‡ΈUnited States jastraat
  • Status changed to Closed: works as designed 4 days ago
  • πŸ‡ΊπŸ‡ΈUnited States jastraat

    This works as designed; the blocks only really exist within the layouts that reference them.

    If you feel otherwise, please open a "feature request" instead of a bug.

Production build 0.71.5 2024