fullcalendar/fullcalendar-workspace

TypeError: "Cannot read property '_raw' of null" when updating resources with setOptions

acerix opened this issue · 4 comments

this bug is reproducible when calling the internal setOptions method, but this has actually been removed in v4.2.x. The way one should add/remove resources is via the Calendar::addResource and Resource::remove methods.

I am not using setOptions anywhere but this error is happening randomly, trying to find the cause, any help will be appreciated. Thanks.

PS: I am using fullcalendar/react which is just a wrapper on fullCalendar, but this issue is only one i found related.

image
For the reference, stack trace if difference from #523 (comment)

main.esm.js:868 Uncaught TypeError: Cannot read property '_raw' of null
    at Object.handleResources [as resources] (main.esm.js:868)
    at main.esm.js:6926
    at Calendar.batchRendering (main.esm.js:6787)
    at Calendar.mutateOptions (main.esm.js:6903)
    at FullCalendar.componentDidUpdate (main.esm.js:74)
    at commitLifeCycles (react-dom.development.js:19868)
    at commitLayoutEffects (react-dom.development.js:22834)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at commitRootImpl (react-dom.development.js:22572)
    at unstable_runWithPriority (scheduler.development.js:653)
    at runWithPriority$1 (react-dom.development.js:11061)
    at commitRoot (react-dom.development.js:22412)
    at finishSyncRender (react-dom.development.js:21838)
    at performSyncWorkOnRoot (react-dom.development.js:21824)
    at react-dom.development.js:11111
    at unstable_runWithPriority (scheduler.development.js:653)
    at runWithPriority$1 (react-dom.development.js:11061)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11106)
    at flushSyncCallbackQueue (react-dom.development.js:11094)
    at scheduleUpdateOnFiber (react-dom.development.js:21230)
    at Object.enqueueSetState (react-dom.development.js:12661)
    at Schedular.push../node_modules/react/cjs/react.development.js.Component.setState (react.development.js:471)
    at Schedular.jsx:135

NVM, my code had logical bug which was passing null resources instead of [] in one case, and next time resources were sent it started throwing this error.
Fixed by passing [] if no resources.