[5.x]: Nested, inline-editable Matrix field with "Min entries" set get recursively created on edit page pageload
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
If an inline-editable Matrix field, with "Min entries" set to 1 and only a single entry type selected, is added to its own entry type (i.e. the field is nested within itself), nested entries are recursively created when the edit page loads. It's also impossible to save the entry.
...I get that this is an odd thing to do – but I wanted to see what would happen if I did, and the results are interesting 🙂
Steps to reproduce
-
Create a Matrix field. Set the "Min entries" setting to
1and "View Mode" to "As inline-editable blocks". Create a new entry type for the Matrix field via the "Create" button, but don't add any fields to the entry type yet. Save the field. -
Edit the entry type that was just created; adding the same Matrix field to its field layout.
-
Add the Matrix field to a section entry type's field layout (or, add the same entry type the Matrix field uses, to a section).
-
Create an entry in that section, and observe that nested entries are created ad infinitum whenever the edit page is loaded. Most of the time only 2 or 3 nested entries are created, sometimes it actually keeps going, creating nested entries indefinitely in a loop (although I have trouble reliably reproducing that)
https://github.com/craftcms/cms/assets/298510/32fc0edb-5fc8-49e0-bca3-03a7467bd529
Expected behavior
I'm not sure!
Actual behavior
A number of nested entries get created every time the edit page is loaded.
Craft CMS version
5.0.0-beta.1
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the listed Matrix-field setup and follow the section entry edit page as nested entries are created on load. Determine the intended behavior for a self-nesting inline-editable field with Min entries set to 1; done should prevent recursive creation and allow the entry to be saved, subject to maintainer clarification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100