messere1 opened a new pull request, #6368: URL: https://github.com/apache/rocketmq-dashboard/pull/6368
## What The broker config dialog (`web/src/pages/cluster/index.tsx`) locks its OK button with the `configSubmitting` state, but that flag only flips **after** `configForm.validateFields()` resolves and React re-renders. A second confirmation click inside that window starts a second `updateClusterConfig` write for the same dialog, so the same broker-config update can go on the wire twice. The same window leaves the **Preview** button active: a preview request issued while a write is in flight returns a diff that describes the cluster mid-write, which the dialog then shows as if it were the steady-state diff. ## How - Guard `handleConfigSubmit` with a synchronous `configSubmittingRef` (flipped before any `await`), following the existing `nsSubmittingRef` convention used by the nameserver dialog in the same file. The `configSubmitting` state stays as the spinner signal. - Disable the config **Preview** button while an update is in flight, so a read can never race the write it is supposed to describe. ## Verification Red/green with `web/src/pages/cluster/__tests__/ClusterPage.test.tsx` (vitest + testing-library): - New test `submits a broker config update once per confirmation` clicks OK twice inside the validate window and asserts `updateClusterConfig` is called exactly once. Without the source change the button never gains `ant-btn-loading` before the second click and the test fails; with it, it passes. - New test `keeps the config preview button inert while an update is in flight` asserts the preview button starts no second read while a write is pending. Both tests were run against the patch (pass) and against the unpatched source (fail), and the full `ClusterPage.test.tsx` suite was green afterwards. -- 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]
