#41291·magento2

Legacy Admin grid filter reset produces malformed and stale URLs

Author: atIOCrONCreated Sep 22, 2026Updated Sep 28, 2026
LabelsIssue: needs updateReported on 2.4.x

Preconditions and environment

  • Clean magento/magento2 checkout of 2.4-develop at efd7420a8d0758777032ee2f6fcc6c922d8bb3f9
  • A legacy Admin grid backed by lib/web/mage/adminhtml/grid.js
  • Reproduced with the upstream Jasmine runner using Chrome Headless Shell 153

Steps to reproduce

  1. Open a legacy Admin grid and apply a filter so the grid URL contains a path parameter such as /filter/old/.

  2. Use a URL which also contains a stale query value and a fragment, for example:

    https://example.test/admin/grid/filter/old/filter/new/?filter=old&keep=1#summary
  3. Reset the grid filter.

  4. Inspect the URL passed to reload() and the URL sent by the AJAX request.

  5. Repeat with sorting or pagination when the same parameter is already present in the query string.

The defect can also be reproduced with focused Jasmine cases which call resetFilter(), doFilter(), doSort(), setPage(), and AJAX reload() against the URLs above. All six cases fail on the stated clean 2.4-develop commit.

Expected result

  • Resetting a filter removes every stale occurrence from both the path and query string.
  • An empty reset is represented by one explicit filter= query value.
  • Applying a new filter, sort, direction, or page value removes stale query duplicates.
  • Unrelated path/query parameters and fragments are preserved.
  • ajax=true is added before the fragment so it is sent to the server.

For the example above, the reset URL should be:

https://example.test/admin/grid/?keep=1&filter=#summary

Actual result

The reset produces a malformed/stale URL similar to:

https://example.test/admin/grid/filter/new/filter/?filter=old&keep=1#summary

The existing implementation:

  • removes only the first matching path occurrence;
  • leaves same-name query parameters in place;
  • treats the parameter name as an unescaped regular expression;
  • appends an empty value as a path segment and then collapses slashes globally; and
  • appends the AJAX flag after a fragment, for example ...?keep=1#summary&ajax=true, so the flag is not part of the HTTP request query.

This can prevent a filter from clearing and can send ambiguous values for filtering, sorting, or pagination.

Additional information

The proposed fix normalizes the existing parameter in both the path and query, uses an explicit empty query value for reset, preserves the fragment, and inserts ajax=true before it.

Focused verification on the clean checkout:

  • Before the fix: 6 Jasmine specs fail.
  • After the fix: 6 Jasmine specs pass, 0 failures.
  • Magento ESLint configuration: 0 errors in the changed source and test.

Release note

Fixed legacy Admin grids so filter resets and subsequent AJAX reloads produce unambiguous URLs while preserving unrelated parameters and fragments.

Triage and priority

  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.