unbridled-41 opened a new pull request, #3154:
URL: https://github.com/apache/rocketmq-dashboard/pull/3154
## Problem / Evidence
Found while fixing #3103 (this is a distinct defect in the same modal; no
issue tracks it and no PR claims it).
`openBrokerConfigDiff` in `web/src/pages/cluster/index.tsx` awaited
`getBrokerConfigDiff(...)` and then unconditionally applied the response to
`brokerConfigDiffState`. Unlike its NameServer twin — which is guarded by
`nsConfigDiffRequestRef` and covered by the regression test `does not reopen a
closed NameServer config diff when its request finishes` — the Broker diff had
no request generation:
1. **Self-reopening dialog:** click 配置差异 on a broker row, click 关闭 before
the response arrives → the pending response re-opened the dialog with the
requested diff.
2. **Wrong cluster's data:** while cluster A's diff was in flight, click
配置差异 on a cluster B row (its button is not disabled) → when A's slower response
landed it overwrote the modal, showing A's title and differences as if they
were B's.
3. A stale failure cleared `loading` with no request check, stopping a newer
request's spinner.
Both triggers are deterministic and reproduced by the new tests, which fail
on the unfixed source.
## Root cause / Fix
Mirror the NameServer pattern: `brokerConfigDiffRequestRef` is bumped when a
request starts, when either close button is clicked, and on unmount; responses
and error handling apply only while the request is still current.
## Priority & scoring
- PRIORITY 71/100: impact 26/40 (misleading read-only drift view — operator
can read another cluster's diff believing it is the requested one; no writes
involved), scope 12/20 (Broker 管理 tab diff action), reproducibility 17/20
(deterministic), maintenance value 16/20 (restores parity with the
already-fixed NameServer twin; repo convention).
- FIX_CONFIDENCE 92/100: clone of the existing, tested NS pattern in the
same file.
## Tests
- New in `ClusterPage.test.tsx` (red on unfixed source, green after):
- `does not reopen a closed Broker config diff when its request finishes`;
- `keeps the requested broker config diff when a slower response finishes
last`.
- `npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx`: 24/24
pass.
- `npx tsc -p tsconfig.app.json --noEmit`, `eslint` on changed files: clean.
## Risk
Low: read-only view change; guards strictly discard responses that are no
longer current. No API or data contract changes.
--
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]