Skip to content

Commit

Permalink
fix: fixing invalid ref with invalid scrollHeight (#2459)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduhdev12 authored Oct 30, 2023
1 parent 6a1c1b1 commit a4bc8f3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TimeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit a4bc8f3

Please sign in to comment.