Problem/Motivation

After updating to Drupal 9.4 when using views with AJAX history enabled the following error was displayed:

An error occured while attempting to process /views/ajax?type=All&page=2&_wrapper_format=drupal_ajax: Failed to execute 'pushState' on 'History'

Steps to reproduce

  1. Using Drupal 9.4
  2. Create a view
  3. Enable views ajax history & ajax
  4. Trigger an ajax command such as pagination
  5. Error is displayed.

Proposed resolution

The issue seems to be because the state contains functions, and these cannot be added successfully pushed to the history, add a clean up script that removes any functions from the state.

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

3li created an issue. See original summary.

3li’s picture

Status: Active » Needs review
FileSize
1.6 KB
Panchuk’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

The patch works well, and should be released ASAP, because this is a critical problem.

Berdir’s picture

For some reason I'm only getting this while testing the 9.5 upgrade and not 9.4, but confirmed, the patch works.

  • amateescu committed 2f41f3c on 8.x-1.x
    Issue #3295914 by 3li: Failed to execute 'pushState' on 'History'
    
amateescu’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x-1.x, thanks!

Status: Fixed » Closed (fixed)

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

phjou’s picture

It would be great to create a new release, I just encountered this bug and the patch works great.

Percept’s picture

It took me a very long time to figure this one out as Firefox gave me a slightly different, less specific, error message (with 0 results in Google):

Error in Firefox:

An error occured while attempting to process /views/ajax?_wrapper_format=drupal_ajax: Function object could not be cloned.

Error in Chrome:

An error occured while attempting to process /views/ajax?_wrapper_format=drupal_ajax: Failed to execute 'pushState' on 'History': function error(xmlhttprequest, status, _error (
ajax.ajaxing = false;
) could not be cloned.

Hopefully this turns up in google now for those using FF.

mmatsoo’s picture

FWIW - this error appeared last week when we upgraded to 9.5.0. Changing to the 8.x-1.x-dev branch fixed it, but it would be great to have a tagged release to use, as per some earlier comments in this thread.

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

siliconmeadow’s picture

@mmatsoo & @phjou - what version are you using? I've upgraded to from 8.x-1.6 to 8.x-1.17 and the problem went away for me. I've not double-checked, but it implies this patch is in the latest release?

luenemann’s picture

Version: 8.x-1.x-dev » 8.x-1.7

8.x-1.7 was released 20 December 2022, and the fix is in that release. See https://www.drupal.org/project/views_ajax_history/releases/8.x-1.7