Search code examples
javascriptreactjsfullcalendarfullcalendar-4

Full calendar on drag events -> Uncaught TypeError: Cannot read property 'isWithinClipping' of undefined


I am implementing fullcalendar.io in my React.js project. When i drag event, sometimes i get this error, can someone tell me what is problem?

Uncaught TypeError: Cannot read property 'isWithinClipping' of undefined
    at HitDragging.queryHitForOffset (static/js/0.chunk.js:14463)
    at HitDragging.handleMove (static/js/0.chunk.js:14427)
    at EmitterMixin.HitDragging.handleDragMove (static/js/0.chunk.js:14360)
    at applyAll (static/js/0.chunk.js:1629)
    at EmitterMixin.triggerWith (static/js/0.chunk.js:4885)
    at EmitterMixin.trigger (static/js/0.chunk.js:4879)
    at EmitterMixin.FeaturefulElementDragging._this.onPointerMove (static/js/0.chunk.js:14113)
    at applyAll (static/js/0.chunk.js:1629)
    at EmitterMixin.triggerWith (static/js/0.chunk.js:4885)
    at EmitterMixin.trigger (static/js/0.chunk.js:4879)
    at HTMLDocument.PointerDragging.handleMouseMove (static/js/0.chunk.js:13229)

This method is used when user resize the specific event:

eventResize = arg => {
    let event = {
        id: arg.event.id,
        start_date: arg.event.start,
        end_date: arg.event.end,
        allDay: arg.event.allDay
    };

    this.setState(prevState => (
        {
            events: prevState.events.map(
                specificEvent => specificEvent.id === event.id ? {
                    ...specificEvent,
                    start: event.start_date,
                    end: event.end_date,
                    allDay: event.allDay
                } : specificEvent
            )
        }));


};

Here also is options for FullCalendar Component last option is for dragging event - EventDrop, this option i got from official documenatiton

<FullCalendar
                            defaultView="dayGridMonth"
                            eventTimeFormat={{
                                hour: '2-digit',
                                minute: '2-digit',
                                hour12: false,
                                meridiem: false
                            }}
                            displayEventEnd={true}
                            timeZone={'local'}
                            defaultDate={new Date()}
                            firstDay={1}
                            header={{
                                left: 'dayGridMonth,timeGridWeek,timeGridDay',
                                center: 'title',
                                right: 'prev,next today'
                            }}
                            businessHours={[ // specify an array instead
                                {
                                    daysOfWeek: [1, 2, 3, 4, 5],
                                    startTime: '08:00', // 8am
                                    endTime: '18:00' // 6pm
                                },

                            ]}
                            plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin, bootstrapPlugin, listPlugin]}
                            themeSystem={"bootstrap"}
                            events={this.state.events}    
                            eventRender={this.eventRender}    
                            dateClick={this.handleDateClick}
                            eventResize={this.eventResize}
                            eventClick={this.eventClicked}    
                            selectMirror={true}
                            weekNumbers={true}
                            weekNumbersWithinDays={true}
                            selectable={true}
                            editable={true}
                            unselectAuto={true}
                            nowIndicator={true}
                            eventDrop={this.eventResize}
                        />

Solution

  • There are some confirmed bugs in the component to cause this error:
    The first looks like your error
    https://github.com/fullcalendar/fullcalendar/issues/5001 - Error when changing validRange from eventDragStart https://github.com/fullcalendar/fullcalendar/issues/4817 - Calls to re-render resources while selecting/dragging/resizing leads to error
    Always go first to the repo of the lib used and look there in open AND closed issues
    Welcome to the bleeding edge of web development ;-)