ivan-lednev / obsidian-day-planner

An Obsidian plugin for day planning with a clean UI and a simple task format
MIT License
1.93k stars 485 forks source link

Calendar Events without a Location Error Out #438

Closed sepatel closed 2 months ago

sepatel commented 2 months ago

Describe the bug If you have a calendar event which does not have a location populated, it causes an error when initializing the day planner for the day. Unsure if this is the root cause for the day planner dying and causing the sidebar to no longer progress and reminders to never go off anymore but it seems likely as it happens pretty regularly and with 3 calendars integrated into it there are bound to be plenty.

Looks like the code is tracked down to

function getNotificationKey(task) {
  return `${task.location.path}::${task.startMinutes}::${task.durationMinutes}::${task.text}`;
}

Where the location property of task is undefined. Thus obtaining a path from it is not possible.

To Reproduce Steps to reproduce the behavior: Setup multiple google calendars. Ensure that an event taking place right now (or about to take place probably) does not have a location property on it.

Expected behavior I should still get a notification about this being a task to work on next.

Additional context Task notification settings are turned on. Pasting screenshots to show the settings as it is likely that it is being triggered because of a non-default setting. image

image

aahventures commented 2 months ago

That's awesome you found the root cause as I think I am also affected by this. Do you plan to open a PR for it?

sepatel commented 2 months ago

Oh sure I can do that. Unsure why the PR itself didn't cross my mind but yeah I can easily fix this and create a PR for it.