Frun1na opened a new pull request, #6113:
URL: https://github.com/apache/rocketmq-dashboard/pull/6113
### Which Issue(s) This PR Fixes
- Fixes #6111
### Brief Description
The Studio-user session drawer presented a failed session read as an account
without sessions. On failure
`loadSessionDetails` (`web/src/pages/studio/UserManagement.tsx:214-233`)
only toasted and cleared the rows, the
drawer's "active sessions" item rendered `sessionDetails.length`
(`:716-720`) as `0`, and the table fell back
to its `noActiveSessions` empty text (`:743-745`). An administrator opening
the drawer to check whether an
account still has live sessions saw "暂无活跃会话" — a claim the loaded data
cannot support — with only a
transient toast and no retry.
The failure is now a state: the count shows the placeholder, the table is
replaced by an error with a retry
that re-runs the read, and the flag resets when the drawer opens or closes
so it never leaks onto the next
account. The genuinely empty case (every session revoked) still reads as "no
active sessions", which the
existing drawer test pins. The retry and the error message reuse
`common.retry` and the existing
`userMgmt.loadSessionsFailed` copy, so no new user-facing text is introduced.
### How Did You Test This Change?
```
$ cd web && npx eslint src/pages/studio/UserManagement.tsx
# clean
$ cd web && npx prettier --check src/pages/studio/UserManagement.tsx
# clean
$ cd web && npx vitest related --run src/pages/studio/UserManagement.tsx
--maxWorkers=1 --fileParallelism=false
✓ src/pages/studio/__tests__/UserManagement.test.tsx (13 tests) 7578ms
✓ src/App.test.tsx (10 tests) 463ms
Test Files 2 passed (2)
Tests 23 passed (23)
$ cd web && npx tsc -b
# clean
```
The new test fails without the fix:
```
$ cd web && npx vitest run src/pages/studio/__tests__/UserManagement.test.tsx
FAIL src/pages/studio/__tests__/UserManagement.test.tsx >
UserManagementPage > does not present a failed session read as an account
without sessions
Error: expect(element).not.toBeInTheDocument()
expected document not to contain element, found <td class="ant-table-cell"
colspan="7"> 暂无活跃会话 </td> instead
Test Files 1 failed (1)
Tests 1 failed | 12 passed (13)
```
(That run is `pages/studio/UserManagement.tsx` reverted and the test kept,
which is also the mutation check;
the case is green again once the fix is restored. The test also pins the
retry: the sessions are re-read and a
row appears.)
### 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]