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

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


The following commit(s) were added to refs/heads/master by this push:
     new c0529a111 fix(topic): budget the comparison table for its expand 
column (#6808)
c0529a111 is described below

commit c0529a111b26698480aa44825a79addccf4791cb
Author: Apulupie <[email protected]>
AuthorDate: Fri Nov 27 12:45:21 2026 +0800

    fix(topic): budget the comparison table for its expand column (#6808)
---
 web/src/components/TopicConfigComparisonModal.tsx     |  5 ++++-
 .../__tests__/TopicConfigComparisonModal.test.tsx     | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/web/src/components/TopicConfigComparisonModal.tsx 
b/web/src/components/TopicConfigComparisonModal.tsx
index e403ea3d8..126d39b86 100644
--- a/web/src/components/TopicConfigComparisonModal.tsx
+++ b/web/src/components/TopicConfigComparisonModal.tsx
@@ -397,7 +397,10 @@ const TopicConfigComparisonModal = ({
                 columns={columns}
                 dataSource={visibleRows}
                 tableLayout="fixed"
-                scroll={{ x: tableScrollX(columns) }}
+                // The expand icon column is rendered by antd and is not part 
of `columns`, so the
+                // table's budget has to reserve it explicitly (48px) or a 
narrow body squeezes the
+                // Topic column below the 240px floor it declares instead of 
scrolling.
+                scroll={{ x: tableScrollX(columns, { expandable: true }) }}
                 pagination={{ pageSize: 20, showSizeChanger: false }}
                 locale={{
                   emptyText: (
diff --git a/web/src/components/__tests__/TopicConfigComparisonModal.test.tsx 
b/web/src/components/__tests__/TopicConfigComparisonModal.test.tsx
index b149269f5..f5166fb0d 100644
--- a/web/src/components/__tests__/TopicConfigComparisonModal.test.tsx
+++ b/web/src/components/__tests__/TopicConfigComparisonModal.test.tsx
@@ -302,4 +302,23 @@ describe('TopicConfigComparisonModal', () => {
 
     expect(onClose).toHaveBeenCalledTimes(1);
   });
+
+  it('declaresAScrollBudgetThatCoversItsExpandColumnTest', async () => {
+    const user = userEvent.setup();
+    renderModal();
+
+    await user.click(screen.getByRole('button', { name: '开始对比' }));
+    await screen.findByText('matching-topic');
+
+    // scroll.x 是这张表的预算:窄到预算以下时表在 .ant-table-body 里横向滚动,宽到预算以上时
+    // 多出的宽度归唯一没有 width 的主列。预算 = 240(Topic 主列 minWidth)+ 120(状态)+ 130
+    //(差异数)+ 48(antd 为展开图标列保留的宽度;展开列不属于 columns,见 utils/table.ts 的
+    // EXPAND_COLUMN_WIDTH)= 538。漏算展开列时预算只有 490:table-layout: fixed 下表宽取容器宽,
+    // 固定列仍占 48 + 120 + 130,Topic 列只剩「容器宽 - 298」,窄窗口下会低过它声明的 240px 下限。
+    const table = 
[...document.querySelectorAll<HTMLTableElement>('table')].find((element) =>
+      /px$/.test(element.style.width),
+    );
+
+    expect(table?.style.width).toBe('538px');
+  });
 });

Reply via email to