unbridled-41 opened a new issue, #4751:
URL: https://github.com/apache/rocketmq-dashboard/issues/4751

   ### Studio Version
   
   branch: rocketmq-studio
   git commit id: cd448e17f14b4bd6e6d4ade87300caf19ca91bc2
   
   ### Problem
   
   Switching the dead-letter message detail drawer to another group keeps the 
previous group's rows and total. The drawer header switches to the new group 
immediately, but the payload below it does not, so the user sees group A's 
messages under group B's title; if the new load fails, those rows stay 
permanently (the error is only added above them), the export button stays 
enabled from A's total, and the batch resend sends A's `msgId`s for group B.
   
   Chain:
   
   - `web/src/pages/instance/dlq.tsx:336-347` (`openDetailDrawer`) cleared 
`detailPage`, `detailSelectedMsgIds` and `detailError` only; `detailMessages` 
and `detailTotal` were left as they were.
   - `web/src/pages/instance/dlq.tsx:353-382` (`loadDetailMessages`) writes the 
rows and the total only on success, so a rejection leaves the previous payload 
untouched and only sets `detailError` (`:372-376`).
   - The rows that render are `dataSource={detailMessages}` under the new title 
(`:828` for the title, `:916` for the table), while `disabled={detailTotal === 
0}` (`:895`) still answers from the previous group's total, and the batch 
resend button (`:986-996`) submits the visible, stale `detailSelectedMsgIds`.
   - The same file already clears that payload on every other scope change: the 
instance/refresh block (`:166-190`, including `setDetailMessages([]); 
setDetailTotal(0);` at `:176-177`) and the drawer's own close handler (`:838`). 
The group switch is the only scope change that does not.
   
   Trigger (deterministic): open 消息明细 for one group, then open it for a second 
group whose `GET /dlq/messages` fails or is slow. The drawer header reads the 
second group while the first group's messages are displayed under it; the 
export button is enabled (stale total) and the selection can be batch-resent 
for the wrong group.
   
   ### Evidence
   
   - `web/src/pages/instance/dlq.tsx:336-347` — the open handler without the 
payload reset.
   - `web/src/pages/instance/dlq.tsx:372-376` — the failure path that keeps the 
previous payload.
   - `web/src/pages/instance/dlq.tsx:176-177` and `:838` — the two places that 
already clear it, i.e. the file's own convention for a scope change.
   - `web/src/pages/instance/dlq.tsx:895`, `:916`, `:986-996` — the export 
state, the rendered rows and the batch resend that act on the stale payload.
   - #4487 (`8457a929 fix(dlq): isolate detail resend state across instance 
switches`) added exactly this pair for the instance switch and the drawer close 
("isolate ... (rows, selection, loading, error) when the instance changes or 
the drawer closes"); the group switch inside one instance was left uncovered.
   - Regression test added with this report (`DLQPage.test.tsx`, "drops the 
previous group messages when the next detail load fails"), failing on cd448e17:
   
   ```
    FAIL  src/pages/instance/__tests__/DLQPage.test.tsx > DLQ page > drops the 
previous group messages when the next detail load fails
    ❯ src/pages/instance/__tests__/DLQPage.test.tsx:304:59
      expect(screen.queryByText('order-dead-letter-1')).not.toBeInTheDocument()
      Tests  1 failed | 21 passed (22)
   ```
   
   ### Impact
   
   A dead-letter drawer that shows another group's messages is misleading in 
itself, and it is actionable in the worst way: the export and the batch resend 
operate on those stale rows, so an operator can resend one group's dead letters 
believing they belong to another. The failure also survives a transient broker 
error, because the error path never clears the payload.
   
   ### Expected behavior
   
   Opening the drawer for a group clears the previous group's rows and total 
before the new request starts, so a failed or in-flight load shows the header, 
the error and an empty (disabled) table — never the previous group's messages.
   
   ### Related work
   
   - #4487 (merged, `8457a929`) — isolated the instance switch and the drawer 
close; this report completes the group switch.
   - #4577/#4579 (open) — the DLQ group *search* term surviving an instance 
switch: same page, different state (the search box, not the drawer payload).
   - #4592 (open) — queues abandoned mid-scan in the resend outcome; same 
drawer, different defect.
   
   #
   
   ## PR
   
   Fix: #4752.
   
   This PR targets the development trunk `rocketmq-studio`. GitHub interprets 
closing keywords only for pull requests that target the repository default 
branch, and this repository default branch is still `master`, so merging the PR 
will not close this issue automatically — it needs to be closed by hand.
   


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