chennaji9 opened a new pull request, #5207:
URL: https://github.com/apache/rocketmq-dashboard/pull/5207

   ### Which Issue(s) This PR Fixes
   
   None — small self-contained fix found by inspection (no issue tracked).
   
   ### Brief Description
   
   `useConversationList` never clamps `page` when the server-side `total` 
shrinks. The delete path in `ConversationListModal` has a manual "fall back one 
page" heuristic, but archiving the last row of the last page (or the list 
shrinking from another client) left the hook requesting a page beyond the new 
last page: an empty table with a pager pointing at a page that no longer 
exists. The hook now clamps `page` to `Math.max(1, Math.ceil(total / 
pageSize))` and lets the page effect re-query. `page` only decreases, so this 
cannot loop, and `total = 0` falls back to page 1.
   
   Base is `rocketmq-studio` per CONTRIBUTING.md (the PR template's base 
comment is outdated).
   
   ### How Did You Test This Change?
   
   `cd web && npx vitest run src/pages/ai/hooks/useConversationList.test.ts 
src/pages/ai/components/__tests__/ConversationListModal.test.tsx`
   
   - `useConversationList.test.ts`: 8/8 pass, including the new 
`clampsThePageWhenTheServerTotalShrinksTest` (page 2 of 16 items, server then 
reports total 1 → a page-1 request is issued and its items displayed) and 
`fallsBackToTheFirstPageWhenTheListBecomesEmptyTest` (total 0 → page 1). Two 
older fixtures whose totals were 0 while requesting page 3/4/5 were updated to 
non-zero totals (total=45/100) so they keep asserting what they meant to assert 
under the new clamp semantics.
   - `ConversationListModal.test.tsx`: 19/19 pass (caller unchanged).
   - `npm run lint`: 0 errors (11 pre-existing warnings, unchanged).
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes (two new hook tests)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
(n/a — no new UI text)
   - [x] Architecture constraints stay green (n/a — no Java change)
   - [x] New source files carry the ASF license header (n/a — no new source 
file)
   - [x] Documentation touched where behaviour changed (code comment explains 
the clamp)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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