Frun1na opened a new pull request, #6831:
URL: https://github.com/apache/rocketmq-dashboard/pull/6831
### Which Issue(s) This PR Fixes
- Fixes #6830
### Brief Description
The consumer client thread-stack modal prints `selectedStack?.threadCount ??
0` in its header row (`web/src/pages/instance/consumer.tsx:2317`).
`selectedStack` is null both while the capture is in flight and after it failed
— `openStackModal` (`:796-821`) records a failure only in `stackError` — so the
row claimed **0 threads** for a count that was never read. `threadCount` is a
required field that only exists on a response (`web/src/api/metadata.ts:137`,
filled with `threads.size()` at
`RocketMQConsumerDiagnosticsProvider.java:113`), and the capture time in the
same block already renders `-` when the stack is missing (`:2314-2316`).
The item now renders `-` while the stack is unavailable, matching the
capture time beside it and the same treatment for unread counts in #6144. The
user-visible change: a failed or still running capture no longer reports a
thread count.
### Other consumers
- `web/src/pages/instance/consumer.tsx:2317` — the item this PR fixes; the
modal's thread list below already renders the "capture unsupported" alert plus
the server reason instead of an empty table.
- `web/src/services/consumerService.ts:275-282` — the demo stack returns a
real response with `threadCount: 0` and `threads: []`; the value is measured
there, so it keeps rendering `0`.
- `web/src/api/metadata.ts:137` and
`server/.../ConsumerStackTraceVO.java:36` — the field stays a required number;
the server always fills it from the captured thread list, so no contract or
sentinel change is needed.
- No other consumers: `git grep threadCount` finds no page, tool catalog or
AI tool output that reads the field outside this modal.
### How Did You Test This Change?
```
$ wb test --filter src/pages/instance/__tests__/ConsumerPage.test.tsx
── web (web)
✓ npx eslint src/pages/instance/__tests__/ConsumerPage.test.tsx
src/pages/instance/consumer.tsx
✓ npx prettier --check src/pages/instance/__tests__/ConsumerPage.test.tsx
src/pages/instance/consumer.tsx
✓ npx vitest run src/pages/instance/__tests__/ConsumerPage.test.tsx
--maxWorkers=1 --fileParallelism=false
✓ npx tsc -b
Test Files 1 passed (1)
Tests 57 passed (57)
$ wb test # every check the change maps to, no filter
✓ eslint / prettier / vitest related / tsc -b
Test Files 3 passed (3)
Tests 68 passed (68)
```
The new test fails without the fix:
```
FAIL src/pages/instance/__tests__/ConsumerPage.test.tsx > Consumer page >
does not report a thread count for a stack capture that never returned
Expected the element to have text content:
-
Received:
0
❯ src/pages/instance/__tests__/ConsumerPage.test.tsx:1356:25
Test Files 1 failed (1)
Tests 1 failed | 56 passed (57)
```
The assertion reads the value cell of the `线程数` item after the capture
rejected, so it is red exactly while `?? 0` is in place and green once the
value is unavailable. (The first draft of the helper grabbed the row's first
content cell, which the two-column layout fills with the neighbouring
capture-time `-`; the committed helper takes the cell after the label.)
### 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]