Views ajax history broken after page reload

Created on 28 October 2019, over 5 years ago
Updated 9 June 2023, about 2 years ago

There is a problem with view_ajax_history on this scenario:

  1. Apply some filters.
  2. Refresh page using F5 or go to other page.
  3. Click back in the browser.

Nothing happens.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇵🇱Poland gugalamaciek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇭Switzerland danielwirz

    Patch in #17 causes issues with range filters, because field names that end with [xxx] are converted to []. That casues problems on range filters, where the field names end with [min] and [max].

  • 🇵🇱Poland gugalamaciek

    There were problem with checking options on first loaded page, when filter were multivalue. Code will explain this (lines starting with + are new ones added in #19, compared to #18):

    // On first loaded page, url can have filters passed in query. They are
    // present in window.location.search. Let's add them to initial filters,
    // when getting back to first loaded page.
    $.each(parseQueryString(window.location.search), function(filter_name) {
    +  // The options.data object stores entries keyed by filter name,
    +  // which works well for single-value filters. For multi-value entries,
    +  // the filter name includes '[]' at the end. We need to remove it
    +  // before checking if options.data has the filter with given name.
    +  filter_name = filter_name.replace(/\[]$/, '');
        if (!options.data.hasOwnProperty(filter_name)) {
          options.data[filter_name] = this;
        }
    });
Production build 0.71.5 2024