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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6098
   
   ### Brief Description
   
   The repository has a documented clamp for server-paginated lists: when a 
page query answers with no rows but a
   non-zero total and the page is past the first one, re-query the last valid 
page instead of rendering a
   permanently empty table (`web/src/pages/ops/alerts.tsx:372-381` calls it 
deliberate policy). Both paginated
   dead-letter lists in `web/src/pages/instance/dlq.tsx` were missing it:
   
   - the group list (`:187`): resending drains dead-letter groups and the 
server reaps empty ones, so a user on
     the last page kept an empty group table with the stale total, the search 
box being the only way out.
   - the message drawer (`:391`): resending every message of the current page 
empties it, and the reload after
     the resend kept the drawer on that page, so the drawer showed an empty 
list until the user paged away.
   
   User-visible change: both lists now recover on their own by re-querying the 
final page, matching the other
   paginated pages. The group list does it the convention's way 
(`setPage(lastPage)` and let the effect re-query);
   the drawer's load is imperative, so it re-runs with the final page in place. 
No new user-facing text.
   
   ### How Did You Test This Change?
   
   ```
   $ cd web && npx eslint src/pages/instance/dlq.tsx
   # clean
   
   $ cd web && npx prettier --check src/pages/instance/dlq.tsx
   # clean
   
   $ cd web && npx vitest related --run src/pages/instance/dlq.tsx 
--maxWorkers=1 --fileParallelism=false
    ✓ src/pages/instance/__tests__/DLQPage.test.tsx (32 tests) 18166ms
    ✓ src/App.test.tsx (10 tests) 465ms
    Test Files  2 passed (2)
         Tests  42 passed (42)
   
   $ cd web && npx tsc -b
   # clean
   ```
   
   The new tests fail without the fix:
   
   ```
   $ cd web && npx vitest run src/pages/instance/__tests__/DLQPage.test.tsx
    FAIL src/pages/instance/__tests__/DLQPage.test.tsx > DLQ page > clamps back 
to the last valid page when the dead-letter groups shrink
    AssertionError: expected last "vi.fn()" call to have been called with [ 
'instance-1', undefined, 1, 20 ]
    FAIL src/pages/instance/__tests__/DLQPage.test.tsx > DLQ page > clamps the 
message drawer back to the last valid page when its page is drained
    Test Files  1 failed (1)
         Tests  2 failed | 30 passed (32)
   ```
   
   (That run is `pages/instance/dlq.tsx` reverted and the tests kept, which is 
also the mutation check; both cases
   are green again once the fix is restored.)
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / 
`refactor:` / `chore:` / `docs:` / `perf:`)
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test`
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [ ] New source files carry the ASF license header
   - [ ] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   


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