Open moritz-sauer-13 opened 2 months ago
When editing a page in a grid field, the problem occurs that the updateFluentActions() method is called twice. This happens both from the FluentSiteTreeExtension and from the FluentGridFieldExtension.
I think I've had this issue before. I ended up solving it by just using a basic model, not a sitetree, which isn't really a reasonable workaround.
Suggested fix is to make the updateFluentAction() idempotent so that it safely can be called multiple times on the same action set.
I have now temporarily written a patch to call the function in the gridfield extension only if the form action is not one of the corresponding model admin. Not a nice solution either, but it works for now.
Module version(s) affected
^7
Description
Description: When editing a page in a grid field, the problem occurs that the updateFluentActions() method is called twice. This happens both from the FluentSiteTreeExtension and from the FluentGridFieldExtension.
This double call results in the clearFluent field and other fields from the corresponding trait being present more than once. This causes a RuntimeException to occur when saving.
Steps for reproduction:
Expected behavior: updateFluentActions() should only be called once to avoid duplicate field definitions and the resulting exception.
Actual behavior: updateFluentActions() is called twice, resulting in duplicate definition of fields and a RuntimeException.
Error Message:
How to reproduce
Model Admin:
FluentAdminTrait - updateFluentActions():
Possible Solution
No response
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)