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 @@ -163,6 +163,7 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
163163 } = props ;
164164
165165 useStylesheet ( styleData , AnalyticalTable . displayName ) ;
166+ const isInitial = useRef ( false ) ;
166167
167168 const alwaysShowSubComponent =
168169 subComponentsBehavior === AnalyticalTableSubComponentsBehavior . Visible ||
@@ -301,6 +302,15 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
301302 // necessary as otherwise values are rounded which leads to wrong total width calculation leading to unnecessary scrollbar
302303 measureElement : ! scaleXFactor || scaleXFactor === 1 ? ( el ) => el . getBoundingClientRect ( ) . width : undefined
303304 } ) ;
305+ // force re-measure if `visibleColumns` change
306+ useEffect ( ( ) => {
307+ if ( isInitial . current && visibleColumns . length ) {
308+ columnVirtualizer . measure ( ) ;
309+ } else {
310+ isInitial . current = true ;
311+ }
312+ } , [ visibleColumns . length ] ) ;
313+
304314 const [ analyticalTableRef , scrollToRef ] = useTableScrollHandles ( updatedRef , dispatch ) ;
305315
306316 if ( parentRef . current ) {
You can’t perform that action at this time.
0 commit comments