How to add library if Ajax is enabled for view?
Found my answer after doing ksm($view)

/**
 * Implements hook_views_pre_render().
 */
function ns_general_views_pre_render(ViewExecutable $view) {
  // Add library to all for ajax progress.
  if($view-&gt;ajaxEnabled()) {
    $view-&gt;element['#attached']['library'][] = 'mytheme/mytheme-custom-indicator';
  }
}