89799969 opened a new pull request, #4324:
URL: https://github.com/apache/rocketmq-dashboard/pull/4324
Fixes #4165
## Problem
On the Cluster page (Broker 管理), the broker config preview panel renders
whichever `previewClusterConfig` response arrives last.
`handleConfigPreview` awaits the request and then unconditionally commits
the result — no request-generation guard — while every comparable async path in
the same file (`nsConfigDiffRequestRef`, `brokerConfigDiffRequestRef`,
`connectionTestRequestRef`) is guarded.
Reproduction: open 配置 → change a value → 预览 (response A slow) → Cancel →
reopen → change values → 预览 (response B arrives) → slow response A resolves
last → the panel shows A's diff while the form holds different values.
## Fix
- Add `configPreviewRequestRef`
- Bump the id on open, close, form change, successful submit, and each
preview request
- Ignore stale preview/error/loading commits when the id no longer matches
## Testing
- `ClusterPage.test.tsx` (26 tests, including `discards a superseded broker
config preview that resolves late`)
```
Test Files 1 passed (1)
Tests 26 passed (26)
```
Local run: Node 20, `npm test -- --run
src/pages/cluster/__tests__/ClusterPage.test.tsx`
--
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]