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.
| Comment | File | Size | Author |
|---|---|---|---|
| Screen Recording 2026-04-27 at 15.13.20.mov | 4.19 MB | nnevill |
Issue fork viewsreference-3587077
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
Comment #3
scott_euser commentedThanks @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.
Comment #5
scott_euser commentedOkay that should do it
Comment #6
nnevillThat worked for me.
Thanks!
Comment #8
scott_euser commentedThanks for confirming!