You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chennaji9 (via GitHub)" <gi...@apache.org> on 2026/09/30 08:08:59 UTC
[PR] fix(ai): clamp the conversation page after the list shrinks [rocketmq-dashboard]
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): clamp the conversation page after the list shrinks [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #5207:
URL: https://github.com/apache/rocketmq-dashboard/pull/5207
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): clamp the conversation page after the list shrinks [rocketmq-dashboard]
Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5207:
URL: https://github.com/apache/rocketmq-dashboard/pull/5207#issuecomment-5988148488
Re-checked the page-clamp math after the list shrinks: the guard still triggers only on the deletion path, so a failed/empty reload keeps the previous page instead of pointing past the end. No conflicts with recent changes to the conversation store as far as I can tell.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org