tju-yxq opened a new issue, #5399:
URL: https://github.com/apache/rocketmq-dashboard/issues/5399

   ## Problem
   
   The DLQ page's two Excel exports are the only unguarded async actions on the 
page: double-clicking the row-level 导出 button or the drawer's 导出全部/导出选中 fires 
the export **twice** — two broker queue scans and two `.xlsx` downloads from 
one intent. The export scans every dead-letter queue in the time range, which 
on a busy DLQ is exactly the kind of operation that should never run duplicated.
   
   Every sibling action on the page is guarded: both resend flows check 
`retryInFlightRef`/`detailResendInFlightRef` before running and disable their 
buttons while in flight, and `DLQPage.test.tsx` even pins the intent with 
"submits one resend when confirm is clicked twice before rendering". The two 
export handlers simply missed the pattern — `handleExport` additionally lacks 
the `!selectedInstanceId` early return that every other handler in the file has.
   
   ## What did you do (steps to reproduce)?
   
   1. Open **Instance > DLQ** for an instance with a group holding dead-letter 
messages (stats available, message count > 0).
   2. Double-click the row's 导出 button (or the drawer's 导出全部 / 导出选中).
   3. Two downloads arrive; the export request fires twice.
   
   ## What did you expect to see?
   
   One export per intent, with the acting button showing its loading state and 
no second request — the same discipline the resend buttons already follow.
   
   ## What did you see instead?
   
   Two export requests and two files.
   
   ## Root cause
   
   `web/src/pages/instance/dlq.tsx`:
   
   - `handleExport` (around line 346): no in-flight ref check, no loading 
state, and no `!selectedInstanceId` early return; the row button (around line 
578) is only disabled by `statsAvailable`/`messageCount`.
   - `exportDetailExcel` (around line 458): has the instance/group early return 
but no in-flight guard and no loading state; the drawer button (around line 
933) is only disabled by `detailTotal === 0`.
   
   Contrast the guarded siblings in the same file: `handleRetry` (line 298) and 
`resendSelectedMessages` (line 422) both start with `if 
(retryInFlightRef.current || detailResendInFlightRef.current) return;` and 
drive `confirmLoading`/`loading` props.
   
   ## Expected behavior
   
   - Both export handlers share one in-flight guard: a second click while an 
export is running does nothing.
   - The acting button (row or drawer) shows its loading state; the other row 
export buttons are disabled while one runs.
   - `handleExport` gains the same `!selectedInstanceId` early return as its 
siblings.
   - Resend flows and everything else are unchanged.
   
   ## Acceptance criteria
   
   - [ ] Regression proof: on the current code, double-clicking 导出 calls 
`exportDLQExcel` twice; with the fix, once.
   - [ ] The acting row button renders loading while its export runs; other 
rows' export buttons are disabled meanwhile.
   - [ ] The drawer export button renders loading while it runs.
   - [ ] Existing export behavior (params, filename, completeness warning, 
download) is unchanged.
   
   ## Environment
   
   Branch `rocketmq-studio` at `6a68042f`; file: 
`web/src/pages/instance/dlq.tsx`.
   
   ## Duplicate check
   
   Searched open and closed issues for `DLQ export` and `export twice`; the DLQ 
export items (#2376/#2490/#2489/#1764) cover bodies, completeness metadata, 
filenames and empty fields — none covers double submission. The open #5386 
covers the retry modal closing during a resend, a different flow.
   


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

Reply via email to