How can I change the number of items in a view only for the first page?
This is how I got it working, use two hooks. Assuming we have a view called my_view and the display is page_1.
Pre-build: Set the items per page to 10 for the first page.
Pre-render: Add an additional CSS class to the view.
/**
 * Implements hook_views_pre_build().
 */
function my_module_views_pre_build(ViewExecutable $view) {
  if ($view-&gt;id() === 'my_view' &amp;&amp; $view-&gt;current_display === 'page_1') {
    // Page is zero indexed: first page is NULL or 0.
    if (!$view-&gt;getRequest()-&gt;query-&gt;get('page')) {
      // Default is 9, we set it to 10.
      $view-&gt;setItemsPerPage(10);
    }
    else {
      // Set the offset on subsequent pages, because we have one more on the first page.
      $view-&gt;setOffset(1);
    }
  }
}

/**
 * Implements hook_views_pre_render().
 */
function my_module_views_pre_render(ViewExecutable $view) {
  if ($view-&gt;id() === 'my_view' &amp;&amp; $view-&gt;current_display === 'page_1' &amp;&amp; !$view-&gt;getCurrentPage()) {
    // Add CSS class for first page.
    $view-&gt;display_handler-&gt;setOption(
      'css_class',
      $view-&gt;display_handler-&gt;getOption('css_class') . ' is-first-page'
    );

    // To attach a library, use:
    // $view-&gt;element['#attached']['library'][] = 'my_module/view-first-page';
  }
}