Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/demo/measureRowRender.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: measureRowRender
nav:
title: measureRowRender
path: /demo
---

<code src="../examples/measureRowRender.tsx"></code>
31 changes: 11 additions & 20 deletions src/FixedHolder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,31 +156,16 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro

const mergedColumnWidth = useColumnWidth(colWidths, columCount);

const colGroupNode = useMemo(() => {
const mayBeEmpty = useMemo<boolean>(() => {
// 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
if (
return (
noData ||
!mergedColumnWidth ||
mergedColumnWidth.length === 0 ||
!mergedColumnWidth.length ||
mergedColumnWidth.every(width => !width)
) {
return ColGroup;
Copy link
Member Author

@li-jia-nan li-jia-nan Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColGroup 是一个函数,直接渲染到 UI 会报错,这里应该返回 null

}
return (
<ColGroup
colWidths={[...mergedColumnWidth, combinationScrollBarSize]}
columCount={columCount + 1}
columns={flattenColumnsWithScrollbar}
/>
);
}, [
noData,
mergedColumnWidth,
combinationScrollBarSize,
columCount,
flattenColumnsWithScrollbar,
]);
}, [noData, mergedColumnWidth]);

return (
<div
Expand All @@ -202,7 +187,13 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
width: scrollX,
}}
>
{colGroupNode}
{mayBeEmpty ? null : (
<ColGroup
colWidths={[...mergedColumnWidth, combinationScrollBarSize]}
columCount={columCount + 1}
columns={flattenColumnsWithScrollbar}
/>
)}
{children({
...restProps,
stickyOffsets: headerStickyOffsets,
Expand Down
2 changes: 1 addition & 1 deletion src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type Component<P> =
| React.ComponentType<P>
| React.ForwardRefExoticComponent<P>
| React.FC<P>
| keyof React.ReactHTML;
| keyof React.JSX.IntrinsicElements;

export type CustomizeComponent = Component<any>;

Expand Down