What happened?
Description
When I set autosaveDrafts to false, toggling a checkbox or a lightswitch, with conditional fields attached to its state, inside a matrix, doesn't work : the fields that are shown don't switch, and the call to /index.php?p=admin%2Factions%2Felements%2Fupdate-field-layout&v=1730400650789 returns a 400 with this output :
{
"name": "Bad Request",
"message": "Invalid element UUID: 8971f694-2b94-4d7b-bb61-3f49f742d244",
"code": 0,
"status": 400,
"exception": "yii\\web\\BadRequestHttpException",
"file": "/var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php",
"line": 2140,
"trace": [
{
"file": "/var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php",
"line": 1880,
"function": "_element",
"class": "craft\\controllers\\ElementsController",
"type": "->"
},
{
"function": "actionUpdateFieldLayout",
"class": "craft\\controllers\\ElementsController",
"type": "->"
},
...
]
}
This happens every time when autosaveDrafts is set to false, but I've also seen it happen a few times when it's enabled, but I haven't been able to really reproduce it in a repeatable way...
Steps to reproduce
- set
autsaveDrafts to false
- Create a matrix with an entry type that contains a lightbox and two other fields, with conditional rules between the three
- In the CP create an entry, add the matrix, and try to toggle the switch with the devtools opened
Alternatively, here is a minimal github repo to easily reproduce it : https://github.com/ajoliveau/bug-conditional-craft
I only did :
ddev config --project-type=craftcms --docroot=web
ddev composer create -y "craftcms/craft"
- Changed the general/config.php file to disable
autosaveDrafts
- Created a section, entry type, matrix field and the three fields
Expected behavior
Fields with conditional rendering conditions should work as intented
Actual behavior
Conditionals are not working
Craft CMS version
5.4.9
PHP version
8.2.24
Operating system and version
Linux 6.11.5-arch1-1
Database type and version
MariaDB 10.11.9
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
None
What happened?
Description
When I set autosaveDrafts to false, toggling a checkbox or a lightswitch, with conditional fields attached to its state, inside a matrix, doesn't work : the fields that are shown don't switch, and the call to /index.php?p=admin%2Factions%2Felements%2Fupdate-field-layout&v=1730400650789 returns a 400 with this output :
This happens every time when autosaveDrafts is set to false, but I've also seen it happen a few times when it's enabled, but I haven't been able to really reproduce it in a repeatable way...
Steps to reproduce
autsaveDraftsto falseAlternatively, here is a minimal github repo to easily reproduce it : https://github.com/ajoliveau/bug-conditional-craft
I only did :
ddev config --project-type=craftcms --docroot=webddev composer create -y "craftcms/craft"autosaveDraftsExpected behavior
Fields with conditional rendering conditions should work as intented
Actual behavior
Conditionals are not working
Craft CMS version
5.4.9
PHP version
8.2.24
Operating system and version
Linux 6.11.5-arch1-1
Database type and version
MariaDB 10.11.9
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
None