Skip to content

Reset pagination on search term change#113

Open
amadulhaxxani wants to merge 1 commit intoclarin-v7from
24-license-administration-rendered-licenses-dont-correspond-to-page-title
Open

Reset pagination on search term change#113
amadulhaxxani wants to merge 1 commit intoclarin-v7from
24-license-administration-rendered-licenses-dont-correspond-to-page-title

Conversation

@amadulhaxxani
Copy link

Problem description

After searching on the License Administration page from a non-first page, the request and UI pagination state were out of sync. The search request loaded first-page results, while the highlighted pagination button and the Showing X - Y of Z range still reflected the previous page.

Analysis

  • Root cause was identified in the analysis: search logic reset page only inside the request pipeline and did not reset the route-backed pagination state.
  • Implemented a dedicated search handler that resets route-backed pagination to page 1 when the search term changes.
  • Removed local scan-based page override logic from data loading and used shared pagination state directly.
  • Updated template search click binding to use the dedicated search handler.
  • Added/updated tests to cover:
    • reset when search term changes
    • no reset when the same term is searched again

Copilot review

  • Requested review from Copilot

Reset pagination on search term change
Copilot AI review requested due to automatic review settings March 19, 2026 10:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes pagination/search state desynchronization on the License Administration page by ensuring the route-backed pagination is reset to page 1 whenever the search term changes, so the UI pager and “Showing X–Y of Z” range match the loaded results.

Changes:

  • Added a dedicated searchLicenses() handler that detects search-term changes and calls PaginationService.resetPage(...).
  • Simplified loadAllLicenses() by removing the in-pipeline scan-based page override logic and relying on shared pagination state (with an optional one-time page override).
  • Updated unit tests and the template click binding to exercise/trigger the new search behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.ts Introduces search handler + removes RxJS scan page-reset workaround; fetch now uses route-backed pagination with optional override.
src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.spec.ts Adds test coverage for “reset on new term” and “no reset on same term”.
src/app/clarin-licenses/clarin-license-table/clarin-license-table.component.html Wires the search button click to searchLicenses() instead of directly calling loadAllLicenses().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

License Administration: rendered licenses don't correspond to page title

2 participants