Skip to content

Commit

Permalink
fix(AnalyticalTable): apply correct column width when hiding columns (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas742 authored Jan 27, 2025
1 parent 8fa84af commit 8354630
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/main/src/components/AnalyticalTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
} = props;

useStylesheet(styleData, AnalyticalTable.displayName);
const isInitial = useRef(false);

useEffect(() => {
if (props.alwaysShowSubComponent != undefined) {
Expand Down Expand Up @@ -308,6 +309,15 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
// necessary as otherwise values are rounded which leads to wrong total width calculation leading to unnecessary scrollbar
measureElement: !scaleXFactor || scaleXFactor === 1 ? (el) => 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) {
Expand Down

0 comments on commit 8354630

Please sign in to comment.