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

   ## Problem
   
   On the Producer page (Studio), switching the selected topic only resets the 
producer-group suggestions. The connection table and the readiness banner keep 
showing the previous topic's query results while the form already points at the 
new topic.
   
   ## Evidence
   
   `web/src/pages/studio/Producer.tsx`:
   
   - `handleInstanceChange` (lines 121-131) clears 
`connectionList`/`connectionSummary` — instance changes are handled.
   - `handleTopicChange` (lines 162-166) clears only `producerGroups` and the 
group input — connection results survive a topic change.
   - `handleExport` (lines 277-294) stamps every exported row with `topic: 
connection.topic ?? selectedTopic` (line 286), so exporting after a topic 
switch labels the previous topic's client connections with the newly selected 
topic.
   
   Two regression tests fail on the unmodified base (`0a596661`):
   
   1. `clears stale connection results when the topic changes` — after querying 
`order-events` successfully and then selecting `payment-events`, 
`within(container).queryByText('producer-1')` still finds the stale client row. 
Red output: `expected document not to contain element, found <td 
...>producer-1</td>`.
   2. `exports connections with the form topic after switching topics` — after 
the switch the export button is still enabled (with the stale rows cached), so 
a click exports the previous topic's connection stamped with `payment-events`.
   
   ## Impact
   
   A user who queries topic A, switches the topic selector to B (the UI 
intentionally does not auto-query on selection change), and then exports or 
reads the table gets topic A's client inventory presented as if it belonged to 
topic B. The readiness banner (`producer.connectionReady`) likewise describes 
the old query while the form shows the new topic.
   
   ## Expected behavior
   
   Changing the topic should invalidate the previous query's visible results 
the same way changing the instance does: clear `connectionList` and 
`connectionSummary` (and let the export button's existing 
`disabled={connectionList.length === 0}` guard take over until a new query is 
run).
   
   ## Related work
   
   - #1593 (closed, fixed by PR #2200) covered invalidation when a *new query 
is submitted* and `handleInstanceChange` covers instance switches; the 
topic-change path was never covered — `handleTopicChange` was introduced in 
commit c7c8e861 with only group-suggestion reset.
   - #1285/#1286 scoped topics and results by *instance*; different dimension.
   - #1041 (502 for non-existent topic) is unrelated.
   
   ## PR
   
   Fix incoming.


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