diff --git a/frontend/src/components/Calendar/CalendarEventPanel.vue b/frontend/src/components/Calendar/CalendarEventPanel.vue index c360f281..6c9c7828 100644 --- a/frontend/src/components/Calendar/CalendarEventPanel.vue +++ b/frontend/src/components/Calendar/CalendarEventPanel.vue @@ -426,6 +426,8 @@ const eventTitle = ref(null) const error = ref(null) const showAllParticipants = ref(false) +const eventResource = ref({}) + const oldEvent = ref(null) const dirty = computed(() => { return JSON.stringify(oldEvent.value) !== JSON.stringify(_event.value) @@ -452,7 +454,7 @@ function fetchEvent() { event.value.id !== 'new-event' && event.value.id !== 'duplicate-event' ) { - let e = createDocumentResource({ + eventResource.value = createDocumentResource({ doctype: 'Event', name: event.value.id, fields: ['*'], @@ -461,9 +463,11 @@ function fetchEvent() { oldEvent.value = { ..._event.value } }, }) - if (e.doc) { - _event.value = parseEvent(e.doc) + if (eventResource.value.doc && !event.value.reloadEvent) { + _event.value = parseEvent(eventResource.value.doc) oldEvent.value = { ..._event.value } + } else { + eventResource.value.reload() } } else { _event.value = event.value diff --git a/frontend/src/pages/Calendar.vue b/frontend/src/pages/Calendar.vue index 4c2d8dae..7f1e5136 100644 --- a/frontend/src/pages/Calendar.vue +++ b/frontend/src/pages/Calendar.vue @@ -190,12 +190,12 @@ function removeTempEvents() { events.data = events.data.filter((ev) => !isTempEvent(ev.id)) } -function openEvent(e, nextMode) { +function openEvent(e, nextMode, reloadEvent = false) { const _e = e?.calendarEvent || e if (!_e?.id || isTempEvent(_e.id)) return removeTempEvents() showEventPanel.value = true - event.value = { id: _e.id } + event.value = { id: _e.id, reloadEvent } activeEvent.value = _e.id mode.value = nextMode } @@ -269,7 +269,7 @@ async function updateEvent(_event, afterDrag = false) { { onSuccess: async (e) => { await events.reload() - showEventPanel.value && showDetails({ id: e.name }) + showEventPanel.value && showDetails({ id: e.name }, true) }, }, ) @@ -315,8 +315,8 @@ onMounted(() => { showEventPanel.value = false }) -function showDetails(e) { - openEvent(e, 'details') +function showDetails(e, reloadEvent = false) { + openEvent(e, 'details', reloadEvent) } function editDetails(e) {