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

   Fixes #4612.
   
   ## Problem / Evidence
   
   On the cluster page a failed registry load silently wipes the data it was 
supposed to refresh:
   
   - `loadRegistryClusters` (`web/src/pages/cluster/index.tsx:205-224`, base 
d50ffecc) catches a failed `listRegistryClusters()` with 
`setRegistryClusters([])` — no error flag, no message, no retry. The Broker and 
Proxy tab tables render from `registryClusters`, so one transient 5xx empties 
both inventories.
   - `loadNsRegistry` (`:230-238`) does the same to the NameServer 注册表 table.
   - These loaders run once on mount (`:226-242`); the 2s auto-refresh loop 
that drives the green 实时刷新 indicator does not re-run them. After a failure the 
page therefore shows empty tables next to a pulsing green "live" dot — "no 
clusters" and "connection healthy" at the same time — until the user manually 
hits refresh.
   - The same page already has the correct pattern one state over: the instance 
list failure sets `instanceLoadError` and renders an error panel with a retry 
button. The registry loaders simply were never aligned with it.
   
   Reproduction is deterministic: open 集群管理 while `/registry/clusters` or 
`/nameservers/registry` returns a transient failure.
   
   ## Root cause / Fix
   
   The registry loaders treated "request failed" and "request returned empty" 
identically. Fix: add a `registryLoadError` flag, set it in both catch 
branches, keep previously loaded rows instead of overwriting them with `[]`, 
render an error banner (`获取数据失败` + 重试) that re-runs both loaders, and clear the 
flag on the next successful load.
   
   ## Priority & scoring
   
   PRIORITY 64 = 影响 24 (all three cluster-page data tabs present an empty 
authoritative-looking inventory after any transient failure) + 波及 10 (two 
loaders + K8s options, one page) + 可复现 16 (deterministic given a failed 
request) + 维护价值 14 (reuses the page's established error-state pattern). 
FIX_CONFIDENCE 92: additive state + one banner, fully covered by a 
deterministic jsdom regression.
   
   ## Tests
   
   ```
   cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx
   ```
   - Red (fix stashed, test present): `Unable to find role="alert"` — on master 
the failed reload renders no error surface and empties the tables.
   - Green: ClusterPage **27 passed (27)** incl. the new regression (banner 
appears with retry, previously loaded rows survive the failure, retry recovers 
and clears the banner) and both request-guard tests from the earlier registry 
work, unchanged.
   - `npx tsc -b`: clean. `npx eslint` on both touched files: 0 errors, 0 
warnings. `npm run build`: ✓ built in 8.55s.
   
   ## Risk
   
   Low. Additive to one page: keep-previous-data on failure, a visible failure 
flag, and a retry action that calls the existing guarded loaders. No API or 
i18n additions (reuses `common.fetchDataFailed`/`common.retry`). The 
empty-state semantics of a genuinely empty registry are unchanged — a 
successful load returning `[]` still clears the tables.


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