Using AJAX history with exposed filters in block works fine when you are on the page. However, we experienced an issue where if you navigate away from that page, then click 'back' to go back there, then back again, the filters become broken.

Comments

Andriy Khomych created an issue. See original summary.

andriy khomych’s picture

Here is a patch for the stable version.

andriy khomych’s picture

andriy khomych’s picture

Assigned: andriy khomych » Unassigned
Status: Active » Needs review
joelpittet’s picture

Status: Needs review » Postponed (maintainer needs more info)

Could you provide some steps to reproduce the bug in the issue summary so people could try it out?

andriy khomych’s picture

Hi, Joël Pittet. Sure, steps to reproduce:
1) Install and configure https://www.drupal.org/project/shs module.
2) Install and configure https://www.drupal.org/project/views.
3) Create some taxonomy vocabulary.
4) Create example view and filter with SHS exposed form, configure to show exposed form as a block in view.
5) Set up in blocks place to render an exposed form.
6) Enable views_ajax_history.
7) Check on the view page some filter values, then for example refresh page, result is that filters are broken.
8) Check on the view page some filter values, then, for example, go back on the page, result is that filters are broken.

Joël Pittet, pls reply if this enough, otherwise I could create some screens as an example.

joelpittet’s picture

Can you reproduce without the SHS module? I lost track of what you were doing at about #4, some of the steps "configure" and "filters are broken" are too generic of terms, ideally you could do this without configuring too much to help determine if it's the configuration, the additional modules or something else causing the issue, if you eliminate possible causes it's more clear how to solve the problem.

screenshots probably wouldn't hurt, especially because "filters are broken" doesn't mean much, could it be JS that they don't trigger click events that is broken, are they visually broken like someone threw them against the wall (hyperbole), what are the symptoms that tell you that it's broken.

I don't mean to sound harsh, just need a bit more info and less dependencies to help resolve this with you.

andriy khomych’s picture

Joël Pittet, no problem, I'll update issue on next week with all necessary info and will provide more details.

anjalikhandelwal’s picture

I followed the steps mentioned in #6 to reproduced the issue and got an error "history.pushState is not a function " while using exposed filters . But it worked fine for me when I commented the line :
History.pushState(options, document.title, cleanURL(url, options.data));
in addState function in views_ajax_history.js file .
Checked by navigating to other page i.e away from view page and then back to the view page by clicking on back button .
Filters worked fine for me .

joelpittet’s picture

@anjalikhandelwal sounds like you are missing the history.js library. Can you check it's installed?

anjalikhandelwal’s picture

yes it is installed

joelpittet’s picture

@anjalikhandelwal on the page that the error exists check that the history.js file is being loaded because the error you get is because it's missing.

joelpittet’s picture

Issue tags: -Ajax, -encode, -url
joseph.olstad’s picture

We're observing an issue where we type.
Légumes with e accent égu
press control F5 in IE11 , get weird character instead of proper é accent.

might be similar.

I've put a workaround in my custom javascript but I'm going to review this patch 3 I think it might help us in a few areas.

joseph.olstad’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

to reproduce, in your search criteria, put double quotes around the search words. Without this patch, the encoding is incorrect.
Tested using Firefox, Chrome, IE11

This patch also resolves IE11 issues with url encoding.

aczietlow’s picture

In case anyone finds this issue and is looking for a d8 fix I re-rolled this patch to fix this exact issue in the 8.x-1.x version of this module. https://www.drupal.org/project/views_ajax_history/issues/3021074

Also +1 for this resolving the above mentioned issue.

joelpittet’s picture

Status: Reviewed & tested by the community » Closed (outdated)

#3021074: Views exposed filters in block breaks when you go back to the page as #16 mentioned should resolve this as well.

Drupal 7 reached end-of-life and the D7 version of Views Ajax History is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues. If you still have questions about using Views Ajax History on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. by reaching out on Drupal Slack.

If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome! 💙

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.