messere1 opened a new pull request, #6448: URL: https://github.com/apache/rocketmq-dashboard/pull/6448
### What problem does this PR solve? The topic send-message dialog's confirm button is only guarded by the `sending` state, which flips after `sendForm.validateFields()` resolves and React re-renders. Until that commit lands, a repeat confirmation re-enters `handleSend`, re-runs the payload pre-check and starts a second `sendTopicMessage` for the same body — the topic receives the test message twice and the pre-check error can interleave with the first success toast. The create dialog in the same file already locks this window synchronously via `createInFlightRef` (`handleCreate`); the send dialog was left with the validate-then-lock shape. ### What is changed and how it works? - `handleSend` now takes a synchronous `sendInFlightRef` and flips `sending` before validation starts, so the dialog locks in the same tick as the first click (the same ref-guard convention `handleCreate` already uses in this file). - The validation-failure path clears both the ref and the state, and the `finally` block releases them, so the modal still stays open for consecutive sends after one completes — that UX is unchanged. ### Verification - Red on the unpatched tip: `sends each test message once per confirmation while the first request is pending` fails at the synchronous `ant-btn-loading` assertion — the confirm button does not lock with the first click. (The call count alone does not discriminate in jsdom: when the second click re-enters during the pending validation, rc-field-form supersedes the first in-flight validation, so only one send is observed there; the lock assertion is what pins the window.) - Green with the patch: both new tests pass, including `keeps the send dialog usable for consecutive sends after one completes`, which pins the consecutive-send flow the fix must not break. - Full file regression: `npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx` — 46/46 pass. - `npx eslint` on both touched files — clean. -- 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]
