This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new 776bc67d5 fix(topic): clear stale comparison results before retry 
(#5188)
776bc67d5 is described below

commit 776bc67d59c27c4fba6f6275cfe4b01e24a6f90d
Author: coder999o <[email protected]>
AuthorDate: Thu Oct 1 17:31:54 2026 +0800

    fix(topic): clear stale comparison results before retry (#5188)
---
 web/src/components/TopicConfigComparisonDrawer.tsx      |  1 +
 .../__tests__/TopicConfigComparisonDrawer.test.tsx      | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/web/src/components/TopicConfigComparisonDrawer.tsx 
b/web/src/components/TopicConfigComparisonDrawer.tsx
index 3204efa2c..66b72d61e 100644
--- a/web/src/components/TopicConfigComparisonDrawer.tsx
+++ b/web/src/components/TopicConfigComparisonDrawer.tsx
@@ -126,6 +126,7 @@ const TopicConfigComparisonDrawer = ({
       return;
     }
     const requestId = ++requestIdRef.current;
+    setResult(null);
     setLoading(true);
     try {
       const [sourceTopics, targetTopics] = await Promise.all([
diff --git a/web/src/components/__tests__/TopicConfigComparisonDrawer.test.tsx 
b/web/src/components/__tests__/TopicConfigComparisonDrawer.test.tsx
index cbe29e551..ed4af0828 100644
--- a/web/src/components/__tests__/TopicConfigComparisonDrawer.test.tsx
+++ b/web/src/components/__tests__/TopicConfigComparisonDrawer.test.tsx
@@ -216,6 +216,23 @@ describe('TopicConfigComparisonDrawer', () => {
     expect(screen.queryByText('配置一致')).not.toBeInTheDocument();
   });
 
+  it('clears a previous comparison when refreshing the same pair fails', async 
() => {
+    const user = userEvent.setup();
+    renderDrawer();
+    const compareButton = screen.getByRole('button', { name: '开始对比' });
+
+    await user.click(compareButton);
+    expect(await screen.findByText('matching-topic')).toBeInTheDocument();
+
+    topicServiceMocks.listAllTopics.mockRejectedValue(new Error('offline'));
+    await user.click(compareButton);
+    await waitFor(() => 
expect(topicServiceMocks.listAllTopics).toHaveBeenCalledTimes(4));
+    await waitFor(() => 
expect(compareButton).not.toHaveClass('ant-btn-loading'));
+
+    expect(screen.queryByText('matching-topic')).not.toBeInTheDocument();
+    expect(screen.queryByRole('button', { name: /导出结果/ 
})).not.toBeInTheDocument();
+  });
+
   it('discards a comparison that resolves after the instance pair changed', 
async () => {
     const archiveInstance: Instance = { ...instances[1], id: 3, name: 
'archive' };
     const pending = new Map<string, (value: Topic[]) => void>();

Reply via email to