From f3bc9ce527f73d58607b7c2a9d60ebafdf2566d9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 2 Sep 2025 23:19:03 +0800 Subject: [PATCH 1/3] refactor: extract colGroup logic into getColGroup function --- src/FixedHolder/index.tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index 48f66b4ae..d0961b279 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -137,6 +137,20 @@ const FixedHolder = React.forwardRef>((pro const mergedColumnWidth = useColumnWidth(colWidths, columCount); + const getColGroup = () => { + // use original ColGroup if no data or no calculated column width, otherwise use calculated column width + if (noData || !mergedColumnWidth) { + return colGroup; + } + return ( + + ); + }; + return (
>((pro ...scrollTableStyle, }} > - {/* use original ColGroup if no data, otherwise use calculated column width */} - {noData ? ( - colGroup - ) : ( - - )} + {getColGroup()} {children({ ...restProps, stickyOffsets: headerStickyOffsets, From bf71c7e69ee0071315e9d2844fbda1bcb8b75231 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 2 Sep 2025 23:25:18 +0800 Subject: [PATCH 2/3] Update src/FixedHolder/index.tsx Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/FixedHolder/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index d0961b279..5e3992382 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -137,7 +137,7 @@ const FixedHolder = React.forwardRef>((pro const mergedColumnWidth = useColumnWidth(colWidths, columCount); - const getColGroup = () => { + const colGroupNode = useMemo(() => { // use original ColGroup if no data or no calculated column width, otherwise use calculated column width if (noData || !mergedColumnWidth) { return colGroup; @@ -149,7 +149,7 @@ const FixedHolder = React.forwardRef>((pro columns={flattenColumnsWithScrollbar} /> ); - }; + }, [noData, mergedColumnWidth, colGroup, combinationScrollBarSize, columCount, flattenColumnsWithScrollbar]); return (
Date: Tue, 2 Sep 2025 23:25:26 +0800 Subject: [PATCH 3/3] Update src/FixedHolder/index.tsx Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/FixedHolder/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index 5e3992382..86e739be1 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -169,7 +169,7 @@ const FixedHolder = React.forwardRef>((pro ...scrollTableStyle, }} > - {getColGroup()} + {colGroupNode} {children({ ...restProps, stickyOffsets: headerStickyOffsets,