Frun1na opened a new pull request, #6117:
URL: https://github.com/apache/rocketmq-dashboard/pull/6117
### Which Issue(s) This PR Fixes
- Fixes #6115
### Brief Description
Opening a LiteTopic session (查看会话) treated a failed read as an empty
session. `handleViewSessions`
(`web/src/pages/studio/LiteTopic.tsx:289-309`) only toasted and cleared the
detail, and `renderSessionContent`
(`:622-628`) renders `common.noData` — "暂无数据" — whenever there is no
`sessionData`, so the drawer body read
as "this session has no data" for a session the table had just listed. The
drawer has no retry and the toast
fades, so the failed read and a genuinely empty result were
indistinguishable.
The failure is now a state: the drawer body shows the failure with a retry
that re-runs the read for the
selected session, and the "no data" fallback is reserved for a read that
actually returned nothing. User-visible
change: a failed session read now says so inside the drawer and can be
retried. The message and the retry reuse
the existing `liteTopic.fetchSessionFailed` and `common.retry` copy, so no
new UI text is introduced.
### How Did You Test This Change?
```
$ cd web && npx eslint src/pages/studio/LiteTopic.tsx
# clean
$ cd web && npx prettier --check src/pages/studio/LiteTopic.tsx
# clean
$ cd web && npx vitest related --run src/pages/studio/LiteTopic.tsx
--maxWorkers=1 --fileParallelism=false
✓ src/pages/studio/__tests__/LiteTopic.test.tsx (17 tests) 8852ms
✓ src/App.test.tsx (10 tests) 430ms
Test Files 2 passed (2)
Tests 27 passed (27)
$ cd web && npx tsc -b
# clean
```
The new test fails without the fix:
```
$ cd web && npx vitest run src/pages/studio/__tests__/LiteTopic.test.tsx
FAIL src/pages/studio/__tests__/LiteTopic.test.tsx > LiteTopic Page >
reports a failed session read instead of presenting the session as empty
Error: expect(element).not.toBeInTheDocument()
expected document not to contain element, found <div style="text-align:
center; padding: 40px;"> 暂无数据 </div> instead
Test Files 1 failed (1)
Tests 1 failed | 16 passed (17)
```
(That run is `pages/studio/LiteTopic.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, which
re-reads the session and renders
its progress panel.)
### 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]