The GitHub Actions job "CI" on 
rocketmq-dashboard.git/fix/pagination-clamp-remaining has failed.
Run started by GitHub user Frun1na (triggered by Frun1na).

Head commit for run:
a9a5c4734677a8cd8a569873c5497abd66a2c8df / Apulupie 
<[email protected]>
fix(web): clamp three more lists back to the first page when they empty out

fix(web): clamp three more lists back to the first page when they empty out

Four list views stopped clamping because the guard that does it was gated on a 
non-zero total:
instance/acl.tsx:212 (rules) and :233 (users), instance/consumer.tsx:347 
(consumer groups) and
instance/topic.tsx:468 (topics) all read

    if (items.length === 0 && total > 0 && page > 1) {
      setPage(Math.max(1, Math.ceil(total / pageSize)));
    }

so `items.length === 0 && total === 0 && page > 1` - the page the operator is 
on no longer exists and
the last valid page is 1 - fell through: no follow-up query, and with total 0 
the pager offers no
other page to click. The two views that already had this fixed, 
settings/CloudCredentialTab.tsx and
settings/DataSourceTab.tsx (#6198), use the un-gated form and move the page 
only when it really is
beyond the last one; the four sites now use that shape and compute the last 
page from the response's
own page size.

One regression test per page drives the list to page 2 and then has the service 
answer
{items: [], total: 0, page: 2}; without the fix the last list call stays on 
page 2 and the test's
`toHaveBeenLastCalledWith({page: 1})` fails.

Verified with `wb test` for the worktree: eslint, prettier, `vitest related` (5 
files, 139 tests) and
`tsc -b` all green. Reverting the three product files, with the tests kept, 
turns the four new cases
red again for the same reason ("expected last vi.fn() call to have been called 
with
[ObjectContaining]").

Report URL: 
https://github.com/apache/rocketmq-dashboard/actions/runs/38347894582

With regards,
GitHub Actions via GitBox

Reply via email to