Repository navigation
Fixes 38927: Show the selected Incident Manager page after paging - #38945
Conversation
Switching pages in the Incident Manager sent two list requests: one for the selected page and one at offset 0, because the page number lands in the URL and the URL-derived filters then retriggered the fetch. 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. A date-range change keeps the page size in the URL. Fixes #38927
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.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Code Review ✅ Approved 🟡 Medium riskUpdating Incident Manager pagination and request ordering changes which incident rows are displayed; regressions could show the wrong page after navigation or filtering. Fixes the Incident Manager showing wrong rows after paging by making each page change send one list request at the selected page's offset, and by dropping stale responses from earlier pages. Filters now exclude pagination params, and the date-range filter keeps VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
* [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.
* fix(ui): fetch one incident page per page change Switching pages in the Incident Manager sent two list requests: one for the selected page and one at offset 0, because the page number lands in the URL and the URL-derived filters then retriggered the fetch. 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. A date-range change keeps the page size in the URL. Fixes #38927 (cherry picked from commit 300a6a8) * 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. (cherry picked from commit 1c7e744) * test(ui): drop the incident browser test on 2.1 2.1 has no Vitest browser setup, so the browser test cannot run there. The Jest integration test covers the same paging behaviour.
Describe your changes:
Fixes #38927
With more than one page of incidents, opening a later page in the Incident Manager could show the wrong rows. For example, the pager said "Page 3 of 3" but the table listed page 1's incidents. Opening the same page again could look right.
Cause: every page change sent two list requests.
handlePagingClickfetched the selected page.usePagingthen wrotecurrentPageinto the URL.filtersis built from every query param, so it changed too, and the fetch effect ran again with no offset, which means page 1.A reload of
?currentPage=Nalso fetched page 1, because the effect never usedcurrentPage.What changed:
useIncidentManagerListPage:filtersleaves out usePaging's params (currentPage,pageSize,cursorType,cursorValue). A page change no longer looks like a filter change.useIncidentList:currentPage. A page click only callshandlePageChange.useIncidentFilters: a date-range change rebuilt the query fromfilters, which now has no paging params. It now carries them over from the URL, sopageSizeis kept; it still resets to page 1.PAGING_URL_PARAMSmoves toconstants.ts. The test-case list, which had the same fix and its own copy of the list, now uses the shared one.Backports: #38946 (
2.0, the reported version) and #38952 (2.1).Type of change:
High-level design:
N/A: a small bug fix in three Incident Manager hooks. It touches more than 5 files only because of tests and the moved constant.
Tests:
Use cases covered
?currentPage=3fetches and shows page 3.Unit tests
pages/IncidentManager/IncidentManagerPage.browser.test.tsx. It runs the whole app with the list API mocked, 35 incidents, and page 1 answering 1 s late.[15, 30]and shows page 3's rows. On the old code the requests were[15, 0, 30, 0].yarn test:ui:runon this file: 2 passed.components/IncidentManager/useIncidentManagerListPage.integration.test.tsx, with the real router,usePagingand URL filters. It covers one request per page, the URL page on first load, a late earlier response, and a filter change on page 3. Three of its tests fail on the old code.useIncidentList.test.ts: a click goes throughhandlePageChange; the fetch uses the current page's offset.IncidentManager.test.tsx: a click sends no request of its own.useIncidentFilters.test.ts: the date range keepspageSize, and the helper models the newfilterswiring.src/components/IncidentManager,src/components/DataQuality/TestCasesandsrc/pages/IncidentManagerall pass. Coverage % was not measured.tscreports no errors in the changed files.Backend integration tests
Ingestion integration tests
Browser test output at
1c7e7448dce(npx vitest run --config vitest.browser.config.ts src/pages/IncidentManager/IncidentManagerPage.browser.test.tsx):On
main's hooks the first test fails withexpected [ 15, +0, 30, +0 ] to deeply equal [ 15, 30 ].Jest at
1c7e7448dce:useIncidentManagerListPage.integration.test.tsx,useIncidentList.test.tsanduseIncidentFilters.test.tsgive 3 suites and 33 tests, all passed.Playwright (UI) tests
IncidentManagerPagination.spec.tsandDataQuality/IncidentManagerDateFilter.spec.tsat1c7e7448dce: 16 passed, 0 failed, 0 flaky, in 2.1 min. That's 13 spec tests plus 3 setup/teardown steps.vitedev server at:3000, against the local server at revision881d635.PLAYWRIGHT_IS_OSS=true PLAYWRIGHT_TEST_BASE_URL=http://localhost:3000 npx playwright test playwright/e2e/Features/IncidentManagerPagination.spec.ts playwright/e2e/Features/DataQuality/IncidentManagerDateFilter.spec.ts.make playwright_affectedselects most of the suite, becauseconstants.tshas no entry in.github/playwright/impact-map.json. The rest of that selection is pending for the merge queue.Manual testing performed
:8585. Created 35 failing test cases (one open incident each) on one table, which is 3 pages at 15 per page.viteon:3000, proxied to:8585, and logged in as admin.testCaseIncidentStatus/search/listrequest and heldoffset=0responses back by 1.5 s.15, 0. Next again showed "Page 3 of 3" with 15 rows starting at the newest incident, which is page 1. This reproduces the report.15, then30). Page 3 shows its 5 rows. A reload of?currentPage=3shows page 3. Previous sends one request at offset 15.UI screen recording:
Recorded with the UI project's Playwright (Chromium, 1440×1500) against a local OpenMetadata server.
{"version":"2.0.0-SNAPSHOT","revision":"881d635254856ebd9ee819d10f401f74a8c95908","timestamp":1795676351225}, healthy. This is an existing dev stack, not a Docker build of this branch.viteon:3000and proxied to the server.incident-paging-check-00…34) on one table, each with a failed result, so 35 open incidents and 3 pages at 15 per page./incident-manager.offset=0) response by 1.5 s to reproduce the slow network that produces the race on every run.search/list) sent after the page loads.Before:
main@b2365bb47e0. The requests areoffset=15, 0, 30, 0. The pager says Page 3 of 3 but shows 15 rows,incident-paging-check-34to20, which is page 1. Page 2 shows page 1's rows too.incident-paging-before-fix.mp4
After: this branch @
1c7e7448dce. The requests areoffset=15, 30, one per click. Page 3 of 3 shows its 5 rows,incident-paging-check-04to00.incident-paging-after-fix.mp4
Checklist:
I have read CONTRIBUTING.md (the pre-review gate) and the contributor docs.
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: not applicable, no schema changes.
For a UI feature or feature task: not applicable, this is a bug fix.
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.300a6a8015ewith a fresh reviewer: no 🔴. I applied its two 🟡 in1c7e7448dce: dropped an unreachable same-page refetch branch and its tests, and moved a mock restore intofinally. I reviewed that commit myself.Decision check: no durable decision. The rule that usePaging's params stay out of URL-derived filters is in the comment on
PAGING_URL_PARAMS.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.
🤖 Generated with Claude Code