Skip to content

[5.x]: Changes to nested elements don't result in a revision being created until the parent is saved #16248

@ryansupercool

Description

@ryansupercool

What happened?

Description

When editing and saving a nested element a revision is not created until after you save the parent despite the changes to nested element being applied to the canonical element. This can be observed when using a Matrix field in table view mode (inline mode does not exhibit this behaviour). We also see this issue within Commerce when managing Products/Variants, as well as in our own nested elements.

Steps to reproduce

Requires a Matrix field with oneEntry type and field. The Matrix field should be set to "Display as an element index" and "Display in a table".

  1. Create a new Entry and save.
  2. A a new Matrix Entry and save, note a revision has been created.
  3. Edit the Matrix Entry and save, note a revision hasn't been created. If you were to view the parent Entry on the frontend you will observe that the Matrix Entry edit is published.
  4. Save the parent Entry, note a revision has now been created.

At the 1:00 minute mark the changes to the Matrix Entry are "live" so it doesn't appear to be a UI bug with the parent Entry not tracking changes. Craft does know something has changed as it will create the revision with the edits to the Matrix Entry when resaving the parent.

Expected behavior

When performing step 3 a revision is created.

Actual behavior

When performing step 3 a revision isn't created.

nested-element-revisions.mp4

Craft CMS version

5.5.4

PHP version

8.2.24

Operating system and version

Linux 6.11.6-orbstack-00279-g28c6c77332e6

Database type and version

MySQL 8.0.36

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions