From 2f4460040b70f93286cc2a3e06bb115da67b01c5 Mon Sep 17 00:00:00 2001 From: Wanpan Date: Fri, 29 May 2026 02:09:43 +0800 Subject: [PATCH 1/2] fix: Render ColGroup even if table has no data to maintain layout consistency Ensures FixedHolder renders the colgroup as long as column widths are available, fixing layout issues when the table is empty but has fixed columns. Fixes #57916. --- src/FixedHolder/index.tsx | 10 +++-- tests/__snapshots__/FixedColumn.spec.tsx.snap | 45 ++++++++++++++----- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index fdcc1132f..0980025c1 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -160,12 +160,14 @@ const FixedHolder = React.forwardRef>((pro const mergedColumnWidth = useColumnWidth(colWidths, columCount); const isColGroupEmpty = useMemo(() => { - // use original ColGroup if no data or no calculated column width, otherwise use calculated column width - // Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy + // ColGroup should be rendered as long as column widths are available, + // even if there is no data. This maintains layout consistency between + // Header, Body, and Summary sections. + // Ref: https://github.com/ant-design/ant-design/issues/57916 const noWidth = !mergedColumnWidth || !mergedColumnWidth.length || mergedColumnWidth.every(w => !w); - return noData || noWidth; - }, [noData, mergedColumnWidth]); + return noWidth; + }, [mergedColumnWidth]); return (
renders correctly > scrollXY - without data 1`] = ` > - - - - - - - - - + + + + + + + + + + Date: Fri, 29 May 2026 02:26:43 +0800 Subject: [PATCH 2/2] refactor: Remove unused noData variable in FixedHolder --- src/FixedHolder/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index 0980025c1..f53b51f3c 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -51,7 +51,6 @@ const FixedHolder = React.forwardRef>((pro const { className, style, - noData, columns, flattenColumns, colWidths,