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
164164 } = props ;
165165
166166 useStylesheet ( styleData , AnalyticalTable . displayName ) ;
167+ const isInitial = useRef ( false ) ;
167168
168169 useEffect ( ( ) => {
169170 if ( props . alwaysShowSubComponent != undefined ) {
@@ -308,6 +309,15 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
308309 // necessary as otherwise values are rounded which leads to wrong total width calculation leading to unnecessary scrollbar
309310 measureElement : ! scaleXFactor || scaleXFactor === 1 ? ( el ) => el . getBoundingClientRect ( ) . width : undefined
310311 } ) ;
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+
311321 const [ analyticalTableRef , scrollToRef ] = useTableScrollHandles ( updatedRef , dispatch ) ;
312322
313323 if ( parentRef . current ) {
You can’t perform that action at this time.
0 commit comments