You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "messere1 (via GitHub)" <gi...@apache.org> on 2026/10/12 11:28:30 UTC

[PR] fix(settings): lock data source creation against repeat confirmations [rocketmq-dashboard]

messere1 opened a new pull request, #6372:
URL: https://github.com/apache/rocketmq-dashboard/pull/6372

   ## What
   
   The add/edit data source dialog (`web/src/pages/settings/DataSourceTab.tsx`) guards its OK button with the `submitting` state, but that flag only flips **after** `dsForm.validateFields()` resolves and React re-renders. A second confirmation click inside that window runs `handleSubmit` again, so the same `createDataSource` (or `updateDataSource`) write goes on the wire twice — and a double-created data source then shows up as two rows in the inventory.
   
   This is a different race from #5216, which handles a save completing after the operator cancelled and reopened the modal; here the trigger is simply two clicks on the same still-enabled OK button.
   
   ## How
   
   - Guard `handleSubmit` with a synchronous `submittingRef` flipped before any `await`, so the second click in the validate window is a no-op.
   - Move `setSubmitting(true)` ahead of `validateFields` so `confirmLoading` reflects the lock immediately (the button now shows its spinner from the first click, not only after validation passes).
   
   ## Verification
   
   Red/green with `web/src/pages/settings/__tests__/DataSourceTab.test.tsx` (vitest + testing-library):
   
   - New test `creates each data source once per modal confirmation` fills the create dialog, clicks OK twice inside the validate window, and asserts `createDataSource` is called exactly once with the typed values. Without the source change the OK button never gains `ant-btn-loading` before the second click and the test fails; with it, it passes.
   - The test was run against the patch (pass) and against the unpatched source (fail); the rest of the suite stays green.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(settings): lock data source creation against repeat confirmations [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6372:
URL: https://github.com/apache/rocketmq-dashboard/pull/6372#issuecomment-6280280521

   This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated 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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(settings): lock data source creation against repeat confirmations [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #6372: fix(settings): lock data source creation against repeat confirmations
URL: https://github.com/apache/rocketmq-dashboard/pull/6372


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org