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

   ## Problem
   
   The cross-instance Topic configuration comparison drawer 
(`TopicConfigComparisonDrawer`, opened from the topic page with 配置对比) guards 
its comparison with a request-generation counter, but only `runComparison` 
bumps it. Changing the compared pair — the 源实例 select, the 目标实例 select, or the 
swap button — clears the visible result without invalidating the request that 
is still in flight.
   
   Steps to reproduce:
   
   1. Open the topic page and click 配置对比.
   2. Pick two instances and click 开始对比.
   3. While the comparison is loading, change the 源实例 (or 目标实例, or press the 
swap button).
   4. The comparison finishes and is rendered for the new selection.
   
   Because the labels are read from the *current* pair while the rows come from 
the *previous* one, the drawer then reports the previous pair's drift under the 
new pair's names: the expanded field table columns are titled 
`sourceInstanceId`/`targetInstanceId` 
(`web/src/components/TopicConfigComparisonDrawer.tsx:313`), and 导出结果 writes 
`rocketmq-topic-config-<new source>-vs-<target>.csv` (`:164`) while the 
exported rows are the stale ones.
   
   ## Studio Version
   
   branch: master
   git commit id: d50ffecc9d7e8f8f46da64198831bd7952e6974e
   deployed as: built from source (frontend only)
   
   ## Evidence
   
   - `web/src/components/TopicConfigComparisonDrawer.tsx:128` bumps 
`requestIdRef` and `:135`/`:141`/`:143` compare against it, but the three 
pair-changing paths at `:211` (源实例), `:224` (目标实例) and `:147` (`swapInstances`) 
only call `setResult(null)`, so the in-flight response still passes the guard 
and repopulates the result.
   - Regression test 
`web/src/components/__tests__/TopicConfigComparisonDrawer.test.tsx` ("discards 
a comparison that resolves after the instance pair changed") fails on `master`:
   
   ```
    FAIL  src/components/__tests__/TopicConfigComparisonDrawer.test.tsx > 
TopicConfigComparisonDrawer > discards a comparison that resolves after the 
instance pair changed
   Error: expect(element).not.toBeInTheDocument()
   expected document not to contain element, found <div 
class="ant-statistic-title">配置一致</div> instead
   
    ❯ src/components/__tests__/TopicConfigComparisonDrawer.test.tsx:243:44
   
    Test Files  1 failed (1)
         Tests  1 failed | 7 passed (8)
   ```
   
   ## Impact
   
   An operator who switches the compared instances while the drawer is loading 
reads a drift report that belongs to a different pair, and can export it under 
the new pair's file name — for example as evidence in a change ticket.
   
   ## Expected behavior
   
   A comparison belongs to the pair it was started for. Once the pair changes, 
a response for the previous pair must be discarded instead of being rendered 
under the new selection.
   
   ## Related work
   
   - #3154 and #4166 (merged) — the same request-ownership contract on the 
cluster page (Broker config diff and preview).
   - #4331 (merged) — unified those per-page request guards, which is the 
pattern this drawer still misses on its pair-changing paths.
   
   ## PR
   
   Fix: #PR_PLACEHOLDER.
   


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