Open adrienharnay opened 2 months ago
I am curious about the crash message you received. Can you copy/paste that here?
@adrienharnay Did you see my notes above?
@adrienharnay Did you see my notes above?
Apologies for the slow response, here is the error:
react-dom.development.js:4312 Uncaught TypeError: Cannot read properties of undefined (reading 'range')
at Calendar._this.handleRangeChange (react-big-calendar.esm.js:4638:27)
at Calendar._this.handleViewChange (react-big-calendar.esm.js:4671:13)
at Calendar._this.handleDrillDown (react-big-calendar.esm.js:4700:23)
at notify (react-big-calendar.esm.js:187:22)
at TimeGridHeader._this.handleHeaderClick (react-big-calendar.esm.js:3514:7)
at onClick (react-big-calendar.esm.js:3593:27)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:14)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:16)
at invokeGuardedCallback (react-dom.development.js:4277:31)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:25)
@adrienharnay Look at my reviews for how to address this
@adrienharnay Look at my reviews for how to address this
Your reviews? Apologies, I did not understand.
You should see my reviews on the 'Files Changed' tab of this PR. Basically I said "do this instead"
handleRangeChange = (date, viewComponent, view) => {
let { onRangeChange, localizer } = this.props
if (onRangeChange) {
if (viewComponent?.range) {
onRangeChange(viewComponent.range(date, { localizer }), view)
} else {
if (process.env.NODE_ENV !== 'production') {
console.error('onRangeChange prop not supported for this view')
}
}
}
}
Hello,
I noticed that when clicking the text in the header on default view, the
handleRangeChange
would be invoked withviewComponent
===undefined
.I have patched the package to avoid the error logs, and am submitting this fix. Feel free to modify if needs be!