obsidian-community/obsidian-full-calendar

Deleting an event should close the modal dialog

Aggtaa opened this issue · 1 comments

Please check that this issue hasn't been reported before.

  • I searched previous Bug Reports and didn't find any similar reports.

Expected Behavior

When a user opens an event from the calendar view, a modal dialog with buttons labeled "Save Event" and "Delete Event" pops up.

Clicking the "Delete Event" button should delete the event and then immediately close the modal dialog

Current behaviour

Clicking the "Delete Event" button deletes the event, but leaves the dialog open.

This brings two problems:

  1. The dialog is left useless.
  2. Clicking the "Save Event" after the event deletion renders error "Error when updating event: Event ID # is not present in event store"

JavaScript console output

No response

Steps to reproduce

  1. Open the calendar week view.
  2. Click the calendar to create an event. Give it a title and save.
  3. See the event created
  4. Click the event, click the "Delete Event" button in the modal dialog.
  5. Error

Calendar information

Full Calendar for Obsidian v0.10.7, daily notes calendar.

Which Operating Systems are you using?

  • macOS
  • Windows
  • Linux
  • Android
  • iOS

Obsidian Version

1.5.12

Full Calendar Plugin Version

0.10.7

Checks

  • I have tried it with all other plugins disabled and the error still occurs.

Possible solution

No response

Comments

No response

Go into your hidden .obsidian folder (use Command Shift . to access hidden folders), then go to /.obsidian/plugins/obsidian-full-calendar/main.js. Scroll down to line 63742 (or use command f and search "Error when deleting". Finally, add this one line:

deleteEvent: () => __async(this, null, function* () {
try {
yield plugin.cache.deleteEvent(eventId);
} catch (e3) {
if (e3 instanceof Error) {
new import_obsidian6.Notice("Error when deleting event: " + e3.message);
console.error(e3);
}
}
closeModal(); // Add This Line.
})
});

Should do the trick!