nhn / tui.calendar

🍞📅A JavaScript calendar that has everything you need.
http://ui.toast.com/tui-calendar
MIT License
11.86k stars 1.28k forks source link

TypeError throw when try to edit / delete schedule in Task #773

Open YoiDuki opened 3 years ago

YoiDuki commented 3 years ago

Describe the bug

Hi guys, when i try to add some my own function before edit/delete schedule events, it throw below exception:

weekView.js:278 Uncaught TypeError: Cannot read property 'fire' of undefined
    at onDeleteSchedule (weekView.js:278)
    at ScheduleDetailPopup.CustomEvents.invoke (tui-code-snippet.js:3230)
    at ScheduleDetailPopup.CustomEvents.fire (tui-code-snippet.js:3185)
    at ScheduleDetailPopup._onClickDeleteSchedule (scheduleDetailPopup.js:110)
    at ScheduleDetailPopup._onClick (scheduleDetailPopup.js:81)
    at HTMLDivElement.handler (domevent.js:54)

It only appears when i set scheduleView: false or scheduleView: ['allday']. It only appears in day/week view, won't appear in month view. So i think that there must be something wrong in time view. Then i look into the callstack, when it ran into function onDeleteSchedule:

onDeleteSchedule = function(eventData) {
    (eventData.isAllDay) {
        weekView.handler.creation.allday.fire('beforeDeleteSchedule', eventData);
    } else {
         weekView.handler.creation.time.fire('beforeDeleteSchedule', eventData);
    }
};

The param of function is not a Schedule object, so it doesn't have a isAllDay prop, then it jump into the else block. But as i set time view as false before, the time object is undefined, so the issue happened,

To Reproduce

Steps to reproduce the behavior:

  1. Create a calendar sample.
  2. set scheduleView as false.
  3. create a schedule, which category is task.
  4. try to edit the schedul or delete it on screen.

Expected behavior

No exception happened and the listener event triggered correctly.

Screenshots

Sample in my code: image

Console print: image

CallStack screenshoot: image

Desktop (please complete the following information):

YoiDuki commented 3 years ago

Added info: I built my project by Typescript & Vue. typescript@^4.1.3 vue@^2.0.0 & vue@^3.0.0 both

jungeun-cho commented 3 years ago

It's a bug, I plan to fix this in the near future.