- Issue created by @ankitv18
In hook acquia_optimize_form_node_form_alter there a Race condition which we need to avoid https://git.drupalcode.org/project/acquia_optimize/-/blob/1.x/acquia_opt...
Use form state storage for tracking state instead of user input, something like this:
$stage = $form_state->get('acquia_optimize_stage') ?: 'initial';
$form_state_input = $form_state->getUserInput();
$is_ajax = array_key_exists('_drupal_ajax', $form_state_input) && $form_state_input['_drupal_ajax'] === '1';
if ($is_ajax && $form_state->getTriggeringElement()['#name'] === 'acquia_optimize_scan_button') {
$form_state->set('acquia_optimize_stage', 'scanning');
$stage = 'scanning';
}
Or please feel free to implement a better approach.
Active
1.1
Code