Skip to content

Commit 1b2723a

Browse files
committed
AT: scrollToRef
1 parent 280ab3f commit 1b2723a

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

packages/main/src/components/AnalyticalTable/TableBody/VirtualTableBody.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ interface VirtualTableBodyProps {
3535
subRowsKey: string;
3636
scrollContainerRef?: MutableRefObject<HTMLDivElement>;
3737
triggerScroll?: TriggerScrollState;
38-
scrollToRef: MutableRefObject<ReactVirtualScrollToMethods>;
3938
rowVirtualizer: Virtualizer<DivWithCustomScrollProp, HTMLElement>;
4039
}
4140

@@ -54,7 +53,6 @@ export const VirtualTableBody = (props: VirtualTableBodyProps) => {
5453
classes,
5554
prepareRow,
5655
rows,
57-
scrollToRef,
5856
isTreeTable,
5957
internalRowHeight,
6058
visibleColumns,
@@ -76,12 +74,6 @@ export const VirtualTableBody = (props: VirtualTableBodyProps) => {
7674
const rowHeight = popInRowHeight !== internalRowHeight ? popInRowHeight : internalRowHeight;
7775
const lastNonEmptyRow = useRef(null);
7876

79-
scrollToRef.current = {
80-
...scrollToRef.current,
81-
scrollToOffset: rowVirtualizer.scrollToOffset,
82-
scrollToIndex: rowVirtualizer.scrollToIndex,
83-
};
84-
8577
useEffect(() => {
8678
if (triggerScroll && triggerScroll.direction === 'vertical') {
8779
if (triggerScroll.type === 'offset') {

packages/main/src/components/AnalyticalTable/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,6 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
368368
}
369369
}, [tableState.groupBy, tableState.columnOrder]);
370370

371-
if (parentRef.current) {
372-
scrollToRef.current = {
373-
...scrollToRef.current,
374-
horizontalScrollToOffset: columnVirtualizer.scrollToOffset,
375-
horizontalScrollToIndex: columnVirtualizer.scrollToIndex,
376-
};
377-
}
378371
useEffect(() => {
379372
if (triggerScroll && triggerScroll.direction === 'horizontal') {
380373
if (triggerScroll.type === 'offset') {
@@ -726,6 +719,16 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
726719
// add range to instance for `useAutoResize` plugin hook
727720
tableInstanceRef.current.virtualRowsRange = rowVirtualizer.range;
728721

722+
if (parentRef.current) {
723+
scrollToRef.current = {
724+
...scrollToRef.current,
725+
horizontalScrollToOffset: columnVirtualizer.scrollToOffset,
726+
horizontalScrollToIndex: columnVirtualizer.scrollToIndex,
727+
scrollToOffset: rowVirtualizer.scrollToOffset,
728+
scrollToIndex: rowVirtualizer.scrollToIndex,
729+
};
730+
}
731+
729732
return (
730733
<div
731734
className={className}
@@ -854,7 +857,6 @@ const AnalyticalTable = forwardRef<AnalyticalTableDomRef, AnalyticalTablePropTyp
854857
classes={classNames}
855858
prepareRow={prepareRow}
856859
rows={rows}
857-
scrollToRef={scrollToRef}
858860
isTreeTable={isTreeTable}
859861
internalRowHeight={internalRowHeight}
860862
popInRowHeight={popInRowHeight}

0 commit comments

Comments
 (0)