diff --git a/packages/main/src/components/AnalyticalTable/index.tsx b/packages/main/src/components/AnalyticalTable/index.tsx index 2a48eae1aba..ab238a1a771 100644 --- a/packages/main/src/components/AnalyticalTable/index.tsx +++ b/packages/main/src/components/AnalyticalTable/index.tsx @@ -164,6 +164,7 @@ const AnalyticalTable = forwardRef { if (props.alwaysShowSubComponent != undefined) { @@ -308,6 +309,15 @@ const AnalyticalTable = forwardRef el.getBoundingClientRect().width : undefined }); + // force re-measure if `visibleColumns` change + useEffect(() => { + if (isInitial.current && visibleColumns.length) { + columnVirtualizer.measure(); + } else { + isInitial.current = true; + } + }, [visibleColumns.length]); + const [analyticalTableRef, scrollToRef] = useTableScrollHandles(updatedRef, dispatch); if (parentRef.current) {