Steps to reproduce:
1. Create 'test' content type and add viewsrefernce field_view with enabled "Limit results" extra option.
2. Install and enable module views_ajax_history.
3. Create a view 'test' with pager (5 items per page), enabled AJAX and AJAX history, add "viewsreference" as an excluded query parameter.
4. Create a node of the 'test' content type and set "Linit results" to 1
5. Open the node page and you'll see it's fine (1 results) unless you use pager (5 results).

I've debugged the thing and found that the culprit is in viewsreference_views_pre_render():

 $display_extenders = $view->display_handler->getOption('display_extenders') ?? [];
    if (!empty($display_extenders['ajax_history']['exclude_args'])) {
      $excluded = preg_split('/[\n\r\s]+/', $display_extenders['ajax_history']['exclude_args']);
      if (in_array('viewsreference', array_filter($excluded), TRUE)) {
        return $view;
      }
    }

With "viewsreference" as exlcuded arg we never reach this code:

$compression = \Drupal::service('viewsreference.compression');
    $view->element['#attached']['drupalSettings']['views']['ajaxViews']['views_dom_id:' . $view->dom_id]['viewsreference'] = $compression->compress($view->element['#viewsreference'], $view);

So the viewsreference plugins logic never applies.

It looks like the issue should be fixed on the AJAX history module side – that exclusion needs to happen on the JavaScript side — Views Ajax History would need to be configured or patched to skip the viewsreference key when constructing the SetBrowserUrl command, rather than preventing the PHP from attaching the data at all.

I've attached a short video to show how the view is configured and how it affects the output.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nnevill created an issue. See original summary.

scott_euser made their first commit to this issue’s fork.

scott_euser’s picture

Assigned: Unassigned » scott_euser

Thanks @nnevill! I think #3574963: exclude_args not applied to exposed form submissions in cleanURL() is the thing needed to be applied then on views ajax history side. Could you check that please?

I'll attempt to get a failing test coverage here and removing that condition for test pass to avoid this regression in the future.

scott_euser’s picture

Assigned: scott_euser » Unassigned
Status: Active » Needs review

Okay that should do it

nnevill’s picture

Status: Needs review » Reviewed & tested by the community

That worked for me.
Thanks!

  • scott_euser committed 6afa230e on 8.x-2.x
    fix: #3587077 The extra settings don’t work with AJAX pager when the...
scott_euser’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for confirming!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.