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

[PR] fix(lite-topic): guard TTL extension against double submission [rocketmq-dashboard]

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

   ## Summary
   Adds a synchronous in-flight guard to the LiteTopic TTL extension flow so two confirmation events delivered in the same render cannot enqueue duplicate `extendLiteTopicTTL` write requests.
   
   ## Root cause
   `handleExtendTTL` relied only on React `extendTTLLoading` state to disable the modal confirm button. React state updates are asynchronous, so two confirmation events delivered before the re-render both passed the guard and called `extendLiteTopicTTL`.
   
   ## Changes
   - Add `extendTTLInFlightRef` and set/clear it synchronously around the API call.
   - Add a LiteTopic page regression test that fires two confirm clicks in the same render against a deferred API promise and asserts the write is issued once.
   
   ## Testing
   Commands run:
   - `cd web`
   - `npx vitest run src/pages/studio/__tests__/LiteTopic.test.tsx`
   - `cd ..`
   - `git diff --check`
   
   Actual results:
   - Vitest: `Test Files 1 passed (1)`, `Tests 15 passed (15)`.
   - `git diff --check`: no output, exit code 0.
   
   I did not run the full Maven/Java backend suite on this Windows host because no Maven wrapper or Maven executable is available and the `rocketmq-studio` server targets Java 21. This PR changes frontend code only.
   
   Fixes #2889
   
   Assisted-by: OpenAI:Codex (GPT-5)
   Percentage of AI-generated code: 100
   


-- 
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(lite-topic): guard TTL extension against double submission [rocketmq-dashboard]

Posted by "btlqql (via GitHub)" <gi...@apache.org>.
btlqql commented on PR #4001:
URL: https://github.com/apache/rocketmq-dashboard/pull/4001#issuecomment-5651572286

   @lizhimins You are right, and I am closing this rather than asking you to re-review it.
   
   I went back to the code and confirmed your reasoning rather than just accepting it. `onOk={handleExtendTTL}` (`web/src/pages/studio/LiteTopic.tsx:885`) is the only call site, and the `<Form>` in the modal body (`:892`) has no `onFinish` — the modal footer sits outside that form, so the Enter and auto-repeat paths you floated do not reach the handler either. `handleOpenExtendTTL` at `:442` is the only way in. With `confirmLoading={extendTTLLoading}` and `node_modules/antd/es/button/button.js:184-187` returning before `onClick`, the guarded path really is unreachable. My test only produced two calls because both clicks were dispatched inside a single `act()`, so it was pinning a property of the harness, exactly as you said.
   
   I also agree about the duplication. Adding a thirteenth local in-flight guard while you are converging these onto one shared hook makes that work harder and buys nothing reachable, so it is not worth taking on those grounds either.
   
   Rather than leave it open as a repro-in-waiting: if I turn up a duplicate-submit path a user can genuinely reach, I will bring it back on top of the shared hook instead of as another local ref.
   
   Thank you for the specific write-up — pointing at the antd button source and at `pages/cluster/index.tsx` was far more useful than a plain rejection would have been.


-- 
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(lite-topic): guard TTL extension against double submission [rocketmq-dashboard]

Posted by "btlqql (via GitHub)" <gi...@apache.org>.
btlqql closed pull request #4001: fix(lite-topic): guard TTL extension against double submission
URL: https://github.com/apache/rocketmq-dashboard/pull/4001


-- 
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