File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/main/src/components/AnalyticalTable Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
164
164
} = props ;
165
165
166
166
useStylesheet ( styleData , AnalyticalTable . displayName ) ;
167
+ const isInitial = useRef ( false ) ;
167
168
168
169
useEffect ( ( ) => {
169
170
if ( props . alwaysShowSubComponent != undefined ) {
@@ -308,6 +309,15 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
308
309
// necessary as otherwise values are rounded which leads to wrong total width calculation leading to unnecessary scrollbar
309
310
measureElement : ! scaleXFactor || scaleXFactor === 1 ? ( el ) => el . getBoundingClientRect ( ) . width : undefined
310
311
} ) ;
312
+ // force re-measure if `visibleColumns` change
313
+ useEffect ( ( ) => {
314
+ if ( isInitial . current && visibleColumns . length ) {
315
+ columnVirtualizer . measure ( ) ;
316
+ } else {
317
+ isInitial . current = true ;
318
+ }
319
+ } , [ visibleColumns . length ] ) ;
320
+
311
321
const [ analyticalTableRef , scrollToRef ] = useTableScrollHandles ( updatedRef , dispatch ) ;
312
322
313
323
if ( parentRef . current ) {
You can’t perform that action at this time.
0 commit comments