don't set cache results to empty array for nested matrix entry with b… #14954
+4
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In a matrix in a matrix setup where both matrix fields are in “as inline-editable blocks” mode and the nested matrix has min entries set to at least 1, the title is hidden, and URI format references the slug; if you add a new top-level matrix entry, the draft won’t be saved because of slug validation issue.
Replication steps:
matrixEt1
entry type with “show the title field” and “show the skug field” disabledmyMatrix1
field, type: matrix, entry type:matrixEt1
, URI: sth/{slug}, min entries: 1, view mode: blocksmatrixEt2
entry type with themyMatrix1
field in itmyMatrix2
field, type: matrix, entry typematrixEt2
, view mode: blockscontentBuilder
entry type with themyMatrix2
field in itcontentBuilder
entry typemyMatrix2
The issue is triggered because when the entry (block) is added, the empty value is being cached, causing the nested entry to be an empty “skeleton” one without a title or slug, which prevents the slug from being correctly set based on the title attribute.
If you reload the page after adding the entry (block), the draft will start being saved as expected.
This PR excludes nested matrix entries from being cached as empty array when normalising field value from request if it’s a nested entry in the blocks view mode.
Screenshot of the replication setup:

Related issues
#14947