How to alter views exposed form and add ajax to filters I have a views with 2 exposed filters - both taxonomy reference, select. 
I want to limit options in second filter based on user selection from the first. Tested with enabled/disabled ajax in views - no difference. Tested with exposed form in block - no difference.

Error message replace target filter: "An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (60 MB) that this server supports."

Using standard form alteration and ajax in form exposed filters, the filtering produce error. This work fine in custom form, but not in views exposed filter.

&lt;?php

use Drupal\Core\Form\FormStateInterface;

function mymodule_form_alter(&amp;$form, FormStateInterface $form_state, $form_id) {  
  if ($form_id == 'views_exposed_form') {
    if ($form['#id'] == 'views-exposed-form-articles-page-1') {
      //kint($form);
      //kint($form_state);
      //
      $form['field_tags2_target_id']['#prefix'] = '&lt;div id="tags2-replace"&gt;';
      $form['field_tags2_target_id']['#suffix'] = '&lt;/div&gt;';

      $form['field_tags_target_id']['#ajax'] = [
        'callback' =&gt; 'tags_ajax_callback',
        'wrapper' =&gt; 'tags2-replace'
      ];
    }
  }
}

function tags_ajax_callback($form, FormStateInterface $form_state) {
  // remove test2 1 (tid 3) from Tags2 options
  unset($form['field_tags2_target_id']['#options'][3]);

  $response = new AjaxResponse();
  $response-&gt;addCommand(new ReplaceCommand(
    '#tags2-replace',
    $form['field_tags2_target_id']
  ));
  return $response;

  //return $form['field_tags2_target_id'];
}


How to make this work?
This patch is related to this issue https://www.drupal.org/files/issues/2019-08-01/2842525-56.patch. See the section core/modules/views/src/ViewExecutable.php especially, the FormBuilder part is already committed but the rest is waiting.