Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')

Hi there,

I’ve downloaded a trial of the Event Calendar and I’m just trying out all the features and customisations to ensure it will do exactly what I need before making a purchase.

Simply using it out of the box, the only properties I’ve added are 4 “calendars”. I’m getting the below error appear in the console randomly. If I highlight the text in “Event name” and the mouse ends up dragged over the calendar itself prompting the popup “You have unsaved changes…” This is sometimes the point when I get the console message. Sometimes it’s when I try to add a second event.

When this happens I can’t click anything and no key presses are registered.

An easy way to recreate the error is to Double Click the calendar to create an event or click " + Create Event", then whilst the right hand pane for adding an event is visible, click the + Create Event" button again. You will receive the “You have unsaved changes…” popup and see the error in the console and be unable to click anything.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘length’)
at Object.p (event-calendar.js:12:196395)
at Object.p (event-calendar.js:12:197303)
at _i (event-calendar.js:12:134548)
at Di (event-calendar.js:12:134217)
p @ event-calendar.js:12
p @ event-calendar.js:12
_i @ event-calendar.js:12
Di @ event-calendar.js:12
Promise.then (async)
wi @ event-calendar.js:12
(anonymous) @ event-calendar.js:12
(anonymous) @ event-calendar.js:12
showModal @ event-calendar.js:12
L @ event-calendar.js:12
A @ event-calendar.js:12
(anonymous) @ event-calendar.js:12

Any help or suggestions would be greatly appreciated.

Thank you.

Hello!

Sorry for the delayed reply, and thank you for reporting the issue!
The issue has been fixed in v2.0.1 What's new | DHTMLX Event Calendar Docs

1 Like

Hi there,
I’ve same issue, but in another case. I’ve Event Calendar v.2.2.1. When added this prop

config: {
        // @ts-ignore
        editorValidation: (event) => {
          console.log(event)
          if (!event.text) return 'Name is required!';
    }
},

Without this config there is no such error.
When I try to save event without text, I receive modal with “Name is required”, after that I’ve got modal “You have unsaved changes” and error in the console and be unable to click anything.

ERROR TypeError: Cannot read properties of undefined (reading 'length')
    at Object.p (Modal.svelte:52:7)
    at Object.p (Modal.svelte:40:21)
    at Ro (index.mjs:1347:36)
    at Fo (index.mjs:1307:17)
    at _ZoneDelegate.invoke (zone.js:365:28)
    at Object.onInvoke (core.mjs:14882:33)
    at _ZoneDelegate.invoke (zone.js:364:34)
    at _ZoneImpl.run (zone.js:111:43)
    at zone.js:2498:40
    at _ZoneDelegate.invokeTask (zone.js:398:33)

Any help or suggestions would be greatly appreciated.

Thank you.

Hello Maxim,
There was a bug in previous versions of the Event Calendar, but it has already been fixed. Please try using the latest version. You can check this example where everything works as expected: DHTMLX Snippet Tool