Skip to content

fix: MCD-1227 Preserve active query filters in views pager page links.#505

Merged
fago merged 1 commit into
2.xfrom
feature/mcd-1227-views-pager-preserve-query
Jul 6, 2026
Merged

fix: MCD-1227 Preserve active query filters in views pager page links.#505
fago merged 1 commit into
2.xfrom
feature/mcd-1227-views-pager-preserve-query

Conversation

@drubot

@drubot drubot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

DrupalViewsPagination (playground component that projects copy) builds page links as bare ?page=N, discarding any other active query params — exposed View filters, search terms, etc. On a decoupled View that exposes filters via GET (e.g. a listing with ?text= fulltext or ?kategorie=<tid> taxonomy), paging to page 2 resets the filters and returns the unfiltered result set.

Fix

Merge page into the current route query (via useRoute()) instead of composing a bare ?page=N. The href stays query-only so it resolves against the current path — this keeps existing selectors like a[href="?page=1"] working. Page 0 drops the page param for a clean canonical first-page URL, and the active page carries aria-current="page".

Test coverage

Adds test/nuxt/drupalViewsPagination.test.ts: mounts the drupal-view custom element with a pager under a filtered route and asserts the page links keep the filters (?text=foo&kategorie=5&page=1), that page 0 drops the param, and that the active page exposes aria-current. Full nuxt suite green (63 tests).

Context

Split off from MCD-1227 / MOP-535. kickstart ships its own i18n copy of this component with the same fix (kickstart PR #1258); this lands the behaviour in the upstream source so downstream copies stay in sync.

🤖 Generated with Claude Code

DrupalViewsPagination built page hrefs as bare ?page=N, discarding any
other active query params. On a decoupled View that exposes filters via
GET (e.g. ?text= fulltext or ?kategorie= taxonomy), paging reset the
filters and returned the unfiltered result set.

Merge page into the current route query instead, keeping the href
query-only so it resolves against the current path. Page 0 drops the
param for a clean canonical first-page URL, and the active page carries
aria-current.

Adds a nuxt render test mounting the drupal-view custom element with a
pager under a filtered route, asserting the page links keep the filters.
@fago fago merged commit ccefc69 into 2.x Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants