Remove link removes all filters

Created on 2 March 2023, over 1 year ago
Updated 27 March 2024, 3 months ago

Problem/Motivation

When a page has query params, such as when a view is not using Ajax or using Ajax with the Views Ajax History module, the individual remove links reset all filters instead of removing the single filter.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇸United States pixelwhip

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

Merge Requests

Comments & Activities

  • Issue created by @pixelwhip
  • 🇺🇸United States pixelwhip

    I've tested this merge request on a view that had single value and multi-value filters, with no Ajax, core Ajax and Ajax with Views Ajax History. It resolved the issues for me.

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States COBadger

    In my testing of this patch, clicking on the "x" for one of the filters caused the page to reload and the other filter values were lost in the reload.

    In my use case the view is added to the page in the page template via lazy views.

  • 🇺🇦Ukraine khiminrm

    Tested the fixes from the MR. They didn't work for me. The page was just reloaded.
    I've found that for multiple value filter the search arguments can have such structure:
    ?geography_type[region]=region&geography_type[country]=country
    So I've added such lines:

              // Remove keyed element.
              url.searchParams.delete(`${selector}[${value}]`);
    

    It helped to fix the remove links I tested.
    Attaching the patch.

  • 🇺🇸United States attheshow

    It looks like neither of the previous patches are applying cleanly to version 2.0.0-alpha3 that was just released this week.

  • 🇮🇳India JaydipJD surat

    I have re-rolled the patch for 2.0.0-alpha3

  • 🇧🇪Belgium leanderjcc Ghent

    Patch from #8 applied and solved the issue for us on a view without AJAX (2.0.0-alpha3).

  • 🇺🇸United States spais

    Confirming patch #8 works on a view without AJAX.

  • Pipeline finished with Success
    3 months ago
    Total: 148s
    #130073
  • 🇺🇸United States pixelwhip

    The original merge request has been updated to include the latest changes from #8 it also reintroduces support for multi-value filters that are formatted as ?filtername[]=foo&filtername[]=bar. This was removed in patch #6. It seems multi-value filters can have different formats in the url search params.

Production build 0.69.0 2024