Skip to content

Commit 636d507

Browse files
fix(AnalyticalTable): don't crash if scrollTo methods are not defined (#515)
1 parent bea48ae commit 636d507

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/main/src/components/AnalyticalTable/hooks/useTableScrollHandles.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ export const useTableScrollHandles = (ref) => {
1010
if (analyticalTableRef.current) {
1111
Object.assign(analyticalTableRef.current, {
1212
scrollTo: (offset, align) => {
13-
reactWindowRef.current.scrollToOffset(offset, { align });
13+
if (typeof reactWindowRef.current?.scrollToOffset === 'function') {
14+
reactWindowRef.current.scrollToOffset(offset, { align });
15+
}
1416
},
1517
scrollToItem: (index, align) => {
16-
reactWindowRef.current.scrollToIndex(index, { align });
18+
if (typeof reactWindowRef.current?.scrollToIndex === 'function') {
19+
reactWindowRef.current.scrollToIndex(index, { align });
20+
}
1721
}
1822
});
1923
}

0 commit comments

Comments
 (0)