react-date-range
react-date-range copied to clipboard
Errors with react list at Calendar mount
Errors with react list at Calendar mount
I am seeing regular errors like this in production: null is not an object (evaluating 'this.list.getVisibleRange') .
The error is that this.list is null in Calendar.focusToDate (https://github.com/Adphorus/react-date-range/blob/master/src/components/Calendar/index.js#L83), after being called from componentDidMount:
componentDidMount() {
if (this.props.scroll.enabled) {
// prevent react-list's initial render focus problem
setTimeout(() => this.focusToDate(this.state.focusedDate));
}
}
I note the comment: "prevent react-list's initial render focus problem" - I wonder if the 0ms timeout is not always sufficient? Does this seems like a likely cause, and, if so, can anyone suggest a resolution?
[BUG] Bug Reproduce Steps
I don't know how to reproduce the issue. I suspect it is a sporadic issue related to react-list not being available when componentDidMount runs.
[BUG] Expected behaviour
No error.
Environment
Package Version: 1.0.3 React version: 16.8.6 Browser: Various
Thanks in advance.
I also have this issue w/ the latest 1.4.0
index.js:152 Uncaught TypeError: Cannot read properties of null (reading 'getVisibleRange')
at Calendar.focusToDate
I'm having the same issue, any updates ?