unbridled-41 opened a new pull request, #5442:
URL: https://github.com/apache/rocketmq-dashboard/pull/5442

   ## Problem / Evidence
   
   Opening a topic's detail while a detail request fails claims the topic has 
no broker route and offers to rebuild it.
   
   - `web/src/pages/instance/topic.tsx:523-546` (pre-fix) awaited 
`loadTopicConsumers(topic)` **before** the route lookup inside the same `try`, 
so a rejected consumers request skipped `getTopicRoutes` entirely (the helper 
itself has no catch).
   - The render then derives everything from the empty fallback: 
`getRoutes(name)` returns `routesByTopic[name] ?? []` (`:571-573`), 
`analyzeTopicRoutes([])` returns the critical `NO_ROUTE`, and the alert's 
action is gated only on `routes.length === 0`, so **在 Broker 上重建** is offered 
for a topic that exists — clicking it calls `createTopic`, which the server 
implements as `admin.createAndUpdateTopicConfig` 
(`RocketMQAdminClientImpl.java:310`), i.e. it rewrites the existing topic's 
queue counts/perm.
   - The consumer table used the same fallback (`?? { items: [], total: 0 }`), 
rendering an empty "no consumers" table with only a transient toast for the 
failure.
   
   Reproduction: open the topic page and click 详情 while `GET 
/topics/{name}/consumers/page` or `GET /topics/{name}/routes` returns a 5xx.
   
   ## Root cause / Fix
   
   "Not loaded" and "loaded and empty" were indistinguishable in the detail 
modal. Fix: load the two independently, track failures per request kind, and 
render the truth:
   
   - a failed route lookup shows `路由诊断:加载失败` with a retry action, and no 
rebuild button;
   - a failed consumer page labels its empty table (`消费者加载失败,请重试`) instead of 
implying nobody consumes the topic.
   
   ## Priority & scoring
   
   PRIORITY 68 = 影响 28 (a transient failure is reported as a definitive 
broker-state verdict, and the offered action rewrites a live topic's config) + 
波及 10 (topic detail for every topic) + 可复现 16 (deterministic given a failing 
request) + 维护价值 14 (reuses the failure-state pattern the pages already have).
   
   FIX_CONFIDENCE 80: two flags and the existing alert/table affordances; 
pinned by two regressions.
   
   ## Tests
   
   ```
   cd web && npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx
   ```
   
   - Red before the fix: `still loads the routes when the consumer page fails…` 
fails (`getTopicRoutes` is never called) and `shows a retry instead of the 
rebuild action when the route request itself failed` fails (`Unable to find an 
element with the text: 路由诊断:加载失败`).
   - Green after: `Tests 36 passed (36)`.
   - `npx tsc -b` and `npx eslint` on both files: clean.
   
   ## Risk
   
   Low. Only the failure states change; the healthy path (routes and consumers 
load, diagnosis renders as before) is untouched.


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