This patch worked in our case, whereas a similar one - https://www.drupal.org/project/autosave_form/issues/3355645 🐛 TypeError: Drupal\Core\Form\FormState::setSubmitHandlers(): Argument #1 ($submit_handlers) must be of type array, null given, called in /web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php on line 139 i Active - did not.
I’ll briefly describe what was happening on our end. The autosave_form module was triggering two AJAX requests handled by AutosaveFormBuilder::processForm:
1. content_moderation_entity_moderation_form
2. node_article_edit_formThe first one was problematic, as it didn't include the autosave_form_save element.
After some investigation, I found that another contributed module was altering the node_article_edit_form via hook_form_node_form_alter() and contained logic like this:
```
$build = Drupal::service('entity_type.manager')
->getViewBuilder($node->getEntityTypeId())
->view($node, 'default');
$output = Drupal::service('renderer')->render($build);
```That render call was triggering the first autosave AJAX request.
With this patch applied, the update for content_moderation_entity_moderation_form is skipped, and only the node_article_edit_form is processed - resolving the issue.
The patch above causes a warning:
```
Warning: Undefined array key "autosave_form_save" in Drupal\autosave_form\Form\AutosaveFormBuilder->processForm() (Zeile 129 in /data/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php)
```So please find an updated patch attached