From e80171e7f958c1a15aa7ba63a19ce81c6e7b9395 Mon Sep 17 00:00:00 2001 From: Lukas Harbarth Date: Wed, 22 Jan 2025 14:46:40 +0100 Subject: [PATCH] fix(AnalyticalTable): apply correct column width when hiding columns --- packages/main/src/components/AnalyticalTable/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/main/src/components/AnalyticalTable/index.tsx b/packages/main/src/components/AnalyticalTable/index.tsx index e721df12090..d3bc6fa46e8 100644 --- a/packages/main/src/components/AnalyticalTable/index.tsx +++ b/packages/main/src/components/AnalyticalTable/index.tsx @@ -163,6 +163,7 @@ 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) {