From a4bc8f3f275ccfba5b6861330b87b39f05505ca8 Mon Sep 17 00:00:00 2001 From: Eduard A <60825949+eduhdev12@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:45:40 +0200 Subject: [PATCH] fix: fixing invalid ref with invalid scrollHeight (#2459) --- src/TimeGrid.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/TimeGrid.js b/src/TimeGrid.js index 90e4029dd..4ae83354b 100644 --- a/src/TimeGrid.js +++ b/src/TimeGrid.js @@ -382,7 +382,11 @@ export default class TimeGrid extends Component { calculateScroll(props = this.props) { const { min, max, scrollToTime, localizer } = props - const diffMillis = localizer.diff(localizer.merge(scrollToTime, min), scrollToTime, 'milliseconds') + const diffMillis = localizer.diff( + localizer.merge(scrollToTime, min), + scrollToTime, + 'milliseconds' + ) const totalMillis = localizer.diff(min, max, 'milliseconds') this._scrollRatio = diffMillis / totalMillis @@ -392,6 +396,8 @@ export default class TimeGrid extends Component { if (this._updatingOverflow) return const content = this.contentRef.current + + if (!content?.scrollHeight) return let isOverflowing = content.scrollHeight > content.clientHeight if (this.state.isOverflowing !== isOverflowing) {