unbridled-41 opened a new pull request, #4615: URL: https://github.com/apache/rocketmq-dashboard/pull/4615
Fixes #4609. ## Problem / Evidence Both config-diff modals on the cluster page (NameServer 管理 and Broker tabs) render a permanent 加载中 info banner when the diff request fails. `openNameServerConfigDiff`/`openBrokerConfigDiff` (`web/src/pages/cluster/index.tsx:373-425`, base d50ffecc) catch a rejected request by only resetting `loading: false`; `result` stays `null`, and the render branch (`:960`/`:1120`) shows `cluster.nsConfigDiffLoading` for every non-result state. The toast disappears within seconds; the modal then looks like it is still loading indefinitely. A node-unreachable failure — the most common real-world case for a diff call that connects to the target node — reproduces this 100% of the time. ## Root cause / Fix The diff state had no failure dimension: the render branch could not distinguish "not loaded yet" from "load failed". Fix: add a `failed` flag to both diff states, set it in the catch branches, and render an error alert with a 重试 button (re-invoking the same guarded opener) in the failed branch. The loading banner now appears only while a request is actually in flight. One pre-existing test that asserted the old behavior (failure keeps the loading banner visible) was updated to assert the error alert instead. ## Priority & scoring PRIORITY 67 = 影响 25 (primary diagnostic path on the cluster page, failure is common) + 波及 10 (two modals, one shared state shape) + 可复现 18 (deterministic on request failure) + 维护价值 14 (aligns the failure path with the repo's established error-state pattern). FIX_CONFIDENCE 95: minimal state addition, fully covered by deterministic jsdom tests. ## Tests ``` cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx ``` - Red (master source + new tests): both new tests fail — `Unable to find an element with the text: NameServer 配置差异检测失败,请稍后重试` / `...Broker 配置差异检测失败` (the modal showed the loading banner instead). - Green: **28 passed (28)** — 2 new regressions (error alert + retry re-issues the request and renders the fresh result) plus the updated legacy failure test; run twice, second run after the final tsc-driven adjustment. - `npx tsc -b`: clean (it caught three close/reset setter sites that also needed `failed: false`). - `npx eslint` on both touched files: 0 errors, 0 warnings. - `npm run build`: ✓ built in 8.39s. ## Risk Low. The change is additive to two modals' local state; the request guards from #4166-family are untouched (the retry goes through the same `begin()/isCurrent()` opener, so a retry racing a stale response is still discarded). No API, i18n key additions reuse existing keys (`cluster.*ConfigDiffFailed`, `common.retry`). CI on this fork's head cannot run (upstream workflow startup_failure is repository-wide, see verification comment). -- 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]
