- 🇨🇦Canada m4olivei Grimsby, ON
Hey there. Arrived here from update hook output. I appretiate the effort here to explain whats going on.
I ran into, what I think is an unintended consequence of the update hook here, (scheduler_update_8208). On the site I'm working on, we're updating scheduler and scheduler_content_moderation_integration to the latest D10 compatible release, which is 2.0.0-rc8 and 2.0.0-beta1 respectively. Both are being updated from 8.x-1.3. We have ... a lot of content types (236 .. I know .. wasn't me ... 😬). We also have 14 form display entities defined for nodes. At the end of the update hook, we end up with 236 * 14 = 3304 new config entities, eg.
core.entity_form_display.node.<bundle>.<form_display>.yml
, which before the update hook we didn't have.Perusing and stepping through the code, I think there is something off with the logic that attempts to remove the scheduler fields when a bundle is not enabled for scheduler (https://git.drupalcode.org/project/scheduler/-/blob/2.0.0-rc8/src/Schedu...):
// If this bundle is not enabled for scheduled (un)publishing or the // form display mode is not supported then remove the field. if (!$bundle->getThirdPartySetting('scheduler', $setting, FALSE) || !in_array($display_mode, $supported_display_modes)) { $form_display->removeComponent($field)->save(); if ($display_mode == $display_repository::DEFAULT_DISPLAY_MODE) { $fields_hidden[$field]["{$bundle->getEntityType()->getCollectionLabel()}"][] = $bundle->label(); } }
Specifically, this code does not consider that the
$form_display
object here may be new, and therefore, may be able to be skipped. However, the line$form_display->removeComponent($field)->save();
will remove a component it doesn't have (b/c it's new) and then save it, which actually creates it for the first time. I don't think this is intentional. I think any$form_display
that is new should be skipped.In our (albeit edge) case, it produces a boat load of form_display entities that we don't want or need. So many, that some CI jobs are blowing up with memory errors (pre-prod, nothing is on fire 😛).
Working on firming up the above theory and potentially filing an issue / patch. Any insight would be helpful, I'm not terribly familiar with this module.
- 🇨🇦Canada m4olivei Grimsby, ON
Opened 🐛 Many unwanted entity_form_display entities created when updating to 2.0.0-rc8 Fixed to follow up with the above. Will need a similar issue for scheduler_content_moderation_integration since it runs a similar update hook that is problematic as well.
- 🇨🇦Canada m4olivei Grimsby, ON
Opened #3359796: Unwanted entity_form_display entities created when updating to 2.0.0-beta1 → for scheduler_content_moderation_integration
- 🇬🇧United Kingdom jonathan1055
Hi m4olivei,
Thanks for reporting this and for taking the time to explain your scenario.
Will continue the discussion on the new issue.
Jonathan