unbridled-41 opened a new pull request, #4833:
URL: https://github.com/apache/rocketmq-dashboard/pull/4833

   ## Problem / Evidence
   
   The notification-deliveries inventory is server-paginated, but its 
pagination `onChange` always stored the page antd handed it, including when the 
*size changer* fired:
   
   ```ts
   onChange: (nextPage, nextPageSize) => {
     setLoading(true);
     setPage(nextPage);        // ← stored even when the size changed
     setPageSize(nextPageSize);
   },
   ```
   
   Reproducible sequence: 45 deliveries, pageSize 20, operator on page 3 → 
switch the size changer to "50 / page":
   
   1. antd fires `onChange(3, 50)`: the code requests page 3 at size 50.
   2. Page 3 no longer exists (45 rows / 50 = 1 page). `total` updates to 45, 
but `current: 3` stays past the last page.
   3. The table renders **permanently empty** with a pager claiming page 3 of 1 
— this list has no empty-page clamp (unlike the rule and audit inventories), so 
the only escape is changing a filter or manually clicking back.
   
   The codebase already recognized this exact hazard elsewhere: 
`web/src/pages/ops/audit.tsx` resets the page on size change with a comment 
spelling out the same scenario, and the alerts-rule page clamps an out-of-range 
page after a shrunk total. The deliveries page — added later — missed both 
protections.
   
   ## Root cause / Fix
   
   Minimal fix, mirroring the established pattern:
   
   - `web/src/pages/ops/notificationDeliveries.tsx`: when `nextPageSize !== 
pageSize`, land on page 1 with the new size; an ordinary page change keeps the 
picked page.
   
   ## Priority / scoring
   
   - Impact 22/40: the operator lands on a blank inventory with no in-page 
recovery, reading "no deliveries" from a list that has 45 rows — on a 
failure-verification screen where a stale "nothing to see" is actively 
misleading.
   - Reach 12/20: the deliveries page is the alert-notification verification 
workflow.
   - Reproducibility 16/20: fully deterministic clicks; no timing or data 
subtlety.
   - Maintenance value 8/20: converges the pagination handler on the pattern 
the audit page already documents.
   - **PRIORITY 52/100**, **FIX_CONFIDENCE 90/100**.
   
   ## Tests
   
   - New regression test "returns to the first page when the page size changes" 
(`web/src/pages/ops/__tests__/NotificationDeliveriesPage.test.tsx`): opens the 
size changer, selects 50/page, and asserts `listAlertDeliveriesPage` is last 
called with `{ page: 1, pageSize: 50 }`. On the pre-fix code the call carried 
`page: 3`-style stale page values, so the assertion fails without the fix.
   - `npx vitest run 
src/pages/ops/__tests__/NotificationDeliveriesPage.test.tsx` → 5 passed (5).
   - `npx tsc --noEmit -p tsconfig.app.json` → clean; `npx eslint` on the 
touched files → clean.
   
   ## Risk
   
   Minimal. Only the size-changer branch of one pagination handler changes; 
ordinary page navigation behaves exactly as before.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to