Skip to content

Fixes #35085: Reset Incident Manager pagination when filters change - #35147

Merged
ShaileshParmar11 merged 3 commits into
mainfrom
detail/bug-fix/fixes-35085-reset-incident-manager-pagination-when-b853c8
Oct 12, 2026
Merged

ShaileshParmar11 merged 3 commits into
mainfrom
detail/bug-fix/fixes-35085-reset-incident-manager-pagination-when-b853c8

Conversation

@detail-app

@detail-app detail-app Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Fixes #35085

I worked on the Incident Manager list page's URL-backed filter hook (useIncidentFilters) because it preserved currentPage (and stale cursor params) verbatim across every filter mutation. When a user paginated past page 1 and then applied a narrowing filter, currentPage pointed past the new last page, so the paginator rendered an invalid "Page N of M" (N > M) with both Prev/Next enabled, and the next Prev/Next click requested an offset past the end of the smaller result set (0 rows → empty-table flash).

The sibling URL-filter hooks (useTestCaseFilters, useTestSuiteFilters) already guard against this exact failure by resetting currentPage to INITIAL_PAGING_VALUE when a filter value actually changes; this PR mirrors them in useIncidentFilters.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

In useIncidentFilters.ts:

  • updateFilters: detects whether any incoming filter key actually differs from the current value (isEqual); on a real change it rewrites the URL with currentPage = INITIAL_PAGING_VALUE and drops stale cursorType/cursorValue (undefined → omitted by qs). Unchanged values keep the existing page, so re-selecting the same option doesn't trigger a phantom refetch. This matches the comment+logic in useTestCaseFilters.handleSearchParam.
  • handleDateRangeClear: omit now also drops currentPage/cursorType/cursorValue so the cleared result set restarts at page 1; pageSize and other filters (e.g. assignee) are preserved.

Used undefined (which qs omits) rather than null (which qs renders as empty cursorType=/cursorValue= params) for the cursor reset.

Tests:

Use cases covered

  • Paginate Incident Manager past page 1, then change assignee/date field/date range → URL resets to page 1 with a valid "Page 1 of M" indicator and no empty-table flash on the next Prev/Next click.
  • Re-selecting an unchanged filter value keeps the current page (no unnecessary refetch).
  • Clearing the date filter drops the date keys and the page/cursor params; pageSize and other filters stay applied.
  • A hand-edited/stale cursorType/cursorValue bookmark is invalidated when a filter changes.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated: openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.test.ts (+8 cases).
  • Added a renderWithUrl helper that mirrors the production filters↔allParams relationship (filters = omit(allParams, ['key','title']) with numeric date coercion) so the tests exercise the real data flow that lets the stale currentPage propagate. The existing test harness injected filters and allParams independently, which masked the bug.
  • Coverage: 18/18 pass.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • I added Playwright E2E tests under openmetadata-ui/.../ui/playwright/ for UI changes.

A relevant existing spec (playwright/e2e/Features/IncidentManagerPagination.spec.ts) covers Next/Previous + page-size but not the paginate→filter→paginate flow that is this bug's reproduction. An analogous spec would be the ideal follow-up. I could not run the existing spec locally: it requires a running OpenMetadata backend on localhost:8585, and the quickstart stack couldn't start (the 1.12.0-SNAPSHOT dev images aren't published — manifest unknown).

Manual testing performed

  • Verified the Vite UI dev server boots and serves /incident-manager (HTTP 200, SPA root present).
  • Could not complete the interactive paginate→filter→paginate reproduction: it requires a seeded backend (≥100 incidents) plus a browser, and no backend was available in this environment (ports 8585/9200/3306 unreachable; prebuilt 1.12.0-SNAPSHOT images return manifest unknown from the registry).
  • Compensated with a falsification check: temporarily reverted updateFilters to the pre-fix body — 5 of the new unit tests failed with Expected: "1" Received: "<stale page>" (the exact symptom from the report); reverting handleDateRangeClear made its dedicated test fail with Received: "5" for currentPage. Restoring the fix returned all 18 to green.

UI screen recording / screenshots:

Not applicable — the visible symptom ("Page N of M" with N > M) requires a seeded multi-page backend not available in this environment; the behavior is proven at the unit level by the falsification check above.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Bug fix

  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

Automatic Fixes PRs can be configured here.

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@detail-app detail-app Bot added the safe to test Add this label to run secure Github workflows on PRs label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 2 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 2 warning(s) across 2 changed file(s).

Count Rule
2 openmetadata-imports/no-lower-layer-page-imports
All findings
Location Rule Message
🟡 src/components/IncidentManager/IncidentManager.test.tsx:18:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/IncidentManager/useIncidentFilters.ts:20:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 76%
76.83% (122342/159233) 62.93% (75847/120512) 64.39% (25441/39509)

@ShaileshParmar11
ShaileshParmar11 added this pull request to the merge queue Oct 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-12T04:14:21Z)

Blocked the queue: ui-coverage

Filter changes now reset currentPage to 1, so the navigate search
strings include currentPage=1.
@sonarqubecloud

Copy link
Copy Markdown

@ShaileshParmar11
ShaileshParmar11 added this pull request to the merge queue Oct 12, 2026
Merged via the queue into main with commit 0f7fdbf Oct 12, 2026
69 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the detail/bug-fix/fixes-35085-reset-incident-manager-pagination-when-b853c8 branch October 12, 2026 12:10
This was referenced Nov 27, 2026
ShaileshParmar11 added a commit that referenced this pull request Nov 27, 2026
* [2.0] Backport #35147 and fix #38927: incident list paging

Backport #35147 (reset Incident Manager pagination when filters change),
then fix the pagination race from #38927: switching pages sent a second
list request at offset 0, and whichever response came back last was
shown, so page 3 could list page 1's rows.

Leave usePaging's params out of the filters, fetch from a single effect
keyed on the current page, and drop responses from superseded requests.

(cherry picked from commit 0f7fdbf)

* test(ui): hold the old page's response in the 2.0 filter-change test

Release the old-offset response after page 1 answers, so the test fails
without the latest-request guard, and pin the two requests a filter
change sends on 2.0.

* refactor(ui): let usePaging drive every incident page change

NextPrevious only asks for the next or previous page, so the same-page
refetch branch in handlePagingClick was unreachable. Drop it and its
tests, and restore the usePaging mock in a finally block so a failing
assertion cannot leak currentPage 3 into later tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Detail Bug] Incident Manager pagination shows invalid page after changing filters (current page not reset)

1 participant