zjncs opened a new pull request, #5636:
URL: https://github.com/apache/rocketmq-dashboard/pull/5636
Closes #5635
## Problem
The repo has an established convention for paginated lists — when a page
query returns `items.length === 0 && total > 0 && page > 1`, the page is reset
to the last valid page and re-queried (alerts.tsx:375-381 documents it as
deliberate policy, "matching the audit page's clamp"). Eight pages implement
it: alerts, audit, acl, UserManagement, topic, consumer,
settings/DataSourceTab, settings/CloudCredentialTab.
`systemAlerts.tsx` was missing it — and system alerts expire/are reaped
server-side, so the feed shrinks under the user: anyone paging to a
now-out-of-range page gets a **permanently empty list** while the pagination
claims more pages. The same page even handles delete-on-last-page in its
silences drawer; the main list just never got the clamp.
## Fix
Apply the identical clamp in the load effect's `.then`, before storing the
result.
## Verification
- New `SystemAlertsClamp.test.tsx` (deterministic): page 1 shows total 25;
clicking page 2 returns `{items: [], total: 20}` — **FAILS on master** (no
clamp refetch: `expected last call to have been called with [ObjectContaining
{"page": 1}]`), **PASSES with this change**
- Regression: the existing `SystemAlertsPage` suite 17/17
- Mutation check: reverting the clamp makes the new test fail again;
restoring it passes
## Collision note (important)
All 13 open PRs touching `systemAlerts.tsx` are based on the
**rocketmq-studio** branch (tju-yxq ×9, Wang1rrr, Loyal-Young, unbridled-41) —
this file has **zero master-based occupants** (verified via the base-ref of
every touching PR), so this master change does not collide with any of them by
GitHub's per-base accounting. Textual overlaps will be resolved when the studio
branch itself merges; the clamp is one self-contained block in the load effect.
--
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]