File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -156,25 +156,16 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
156
156
157
157
const mergedColumnWidth = useColumnWidth ( colWidths , columCount ) ;
158
158
159
- const renderColGroup = ( ) => {
159
+ const mayBeEmpty = useMemo < boolean > ( ( ) => {
160
160
// use original ColGroup if no data or no calculated column width, otherwise use calculated column width
161
161
// Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy
162
- if (
162
+ return (
163
163
noData ||
164
164
! mergedColumnWidth ||
165
- mergedColumnWidth . length === 0 ||
165
+ ! mergedColumnWidth . length ||
166
166
mergedColumnWidth . every ( width => ! width )
167
- ) {
168
- return ColGroup ;
169
- }
170
- return (
171
- < ColGroup
172
- colWidths = { [ ...mergedColumnWidth , combinationScrollBarSize ] }
173
- columCount = { columCount + 1 }
174
- columns = { flattenColumnsWithScrollbar }
175
- />
176
167
) ;
177
- } ;
168
+ } , [ noData , mergedColumnWidth ] ) ;
178
169
179
170
return (
180
171
< div
@@ -196,7 +187,13 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
196
187
width : scrollX ,
197
188
} }
198
189
>
199
- { renderColGroup ( ) }
190
+ { mayBeEmpty ? null : (
191
+ < ColGroup
192
+ colWidths = { [ ...mergedColumnWidth , combinationScrollBarSize ] }
193
+ columCount = { columCount + 1 }
194
+ columns = { flattenColumnsWithScrollbar }
195
+ />
196
+ ) }
200
197
{ children ( {
201
198
...restProps ,
202
199
stickyOffsets : headerStickyOffsets ,
You can’t perform that action at this time.
0 commit comments