From e3a2b5260efec37b12f94808ed8fa719888974af Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Tue, 9 Aug 2022 17:36:38 +0200 Subject: [PATCH] fix(ui) - scrollToRow check for the element exist --- frontend/app/components/Session_/TimeTable/TimeTable.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/Session_/TimeTable/TimeTable.tsx b/frontend/app/components/Session_/TimeTable/TimeTable.tsx index a2c7ef61c..9ea553dc1 100644 --- a/frontend/app/components/Session_/TimeTable/TimeTable.tsx +++ b/frontend/app/components/Session_/TimeTable/TimeTable.tsx @@ -118,7 +118,9 @@ export default class TimeTable extends React.PureComponent { autoScroll = true; componentDidMount() { - this.scroller.current.scrollToRow(this.props.activeIndex); + if (this.scroller.current) { + this.scroller.current.scrollToRow(this.props.activeIndex); + } } componentDidUpdate(prevProps: any, prevState: any) { @@ -135,7 +137,7 @@ export default class TimeTable extends React.PureComponent { ...computeTimeLine(this.props.rows, this.state.firstVisibleRowIndex, this.visibleCount), }); } - if (this.props.activeIndex >= 0 && prevProps.activeIndex !== this.props.activeIndex) { + if (this.props.activeIndex >= 0 && prevProps.activeIndex !== this.props.activeIndex && this.scroller.current) { this.scroller.current.scrollToRow(this.props.activeIndex); } }