Skip to content

[5.x]: Axios error when adding/deleting nested entries in Matrix field, causing field layout/conditions not to update #16558

@mmikkel

Description

@mmikkel

What happened?

Description

If a field has a condition rule "Has a value" dependent on a Matrix field using the Cards view mode, adding or deleting nested entries in that Matrix field does not automatically update the field layout. I.e. the conditional fields are not made visible or hidden until the browser is reloaded, or a different change to the owner element occurs.

There is a JavaScript AxiosError logged to the console when this happens, specifically Request failed with status code 302. Looks like the request that fails is to the actions/elements/update-field-layout action, so I assume this is the culprit 🙂

Here's the JS error: https://pastebin.com/Hthd67wD
...and the full stack trace: https://pastebin.com/HJeBsduk

CleanShot.2025-01-28.at.13.03.23.mp4

Steps to reproduce

  1. Add a Matrix field named "Matrix Field" using the Cards view mode to a field layout
  2. Add a different field "Some Field" to the same layout, and create an entry condition rule [Matrix Field] [Has a value] for this field
  3. Visit the edit page for an entry using this field layout. Create a nested entry in the Matrix field, and observe that the field layout is not updated after closing the nested entry slideout (i.e. the "Some Field" field is not made visible).
  4. Reload the browser. Observe that the "Some Field" field is now visible.
  5. Delete the nested entry from the Matrix field via the nested entry's card action menu. Observe that the field layout is not updated, i.e. the "Some Field" field is still visible.

Expected behavior

Adding and removing nested entries in a Matrix field should trigger field layout update to show or hide fields based on condition rules for the Matrix field, regardless of the Matrix field's view mode.

Actual behavior

Matrix fields using the Cards view mode does not trigger field layout update after adding or removing nested entries.

Craft CMS version

5.6.1

PHP version

8.2.26 (DDEV v1.24.1)

Operating system and version

macOS 14.6.1, MS Edge 131.0.2903.112

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

None

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions