mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-13 15:29:36 +00:00
BUG: Fixed issue with reverting failed updated events
This commit is contained in:
@@ -123,6 +123,10 @@ export default {
|
||||
draggableEvents: [Boolean, Array, Function],
|
||||
dropableEvents: [Boolean, Array, Function],
|
||||
resizableEvents: [Boolean, Array, Function],
|
||||
eventReloadKey: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
onDragover: Function,
|
||||
onDrop: Function,
|
||||
onResize: Function
|
||||
@@ -321,6 +325,7 @@ export default {
|
||||
</base-header>
|
||||
<component
|
||||
:is="modes ? modes[cMode] : null || 'div'"
|
||||
:key="eventReloadKey"
|
||||
ref="mode"
|
||||
v-model:current-date="cDate"
|
||||
:range-end="pickedRangeEnd"
|
||||
@@ -343,4 +348,4 @@ export default {
|
||||
</bs-modal>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
eventReloadKey: 0,
|
||||
refreshEventsAfterReload: false,
|
||||
modes: {
|
||||
week: Vue.markRaw(ModeWeek),
|
||||
month: Vue.markRaw(ModeMonth),
|
||||
@@ -108,6 +110,11 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
events() {
|
||||
if (this.refreshEventsAfterReload) {
|
||||
this.eventReloadKey += 1;
|
||||
this.refreshEventsAfterReload = false;
|
||||
}
|
||||
|
||||
this.$emit('events-reloaded');
|
||||
}
|
||||
},
|
||||
@@ -186,6 +193,10 @@ export default {
|
||||
resetEventLoader(arePreviousEventsCleared = true) {
|
||||
this.reset(arePreviousEventsCleared);
|
||||
},
|
||||
reloadEvents() {
|
||||
this.refreshEventsAfterReload = true;
|
||||
this.resetEventLoader(false);
|
||||
},
|
||||
navigatePrev() {
|
||||
this.$refs.calendar.clickPrev();
|
||||
},
|
||||
@@ -259,6 +270,7 @@ export default {
|
||||
:timezone="timezone"
|
||||
:locale="$p.user_locale.value"
|
||||
:events="visibleEvents || []"
|
||||
:event-reload-key="eventReloadKey"
|
||||
:backgrounds="backgrounds"
|
||||
:time-grid="showRaster ? teachingunits : null"
|
||||
:hours-plan="hoursplan"
|
||||
|
||||
@@ -551,6 +551,14 @@ export default {
|
||||
this.$refs.calendar.$refs.calendar.$refs.mode.$refs.view.$refs.grid.disableAutoScroll();
|
||||
this.currentlyUpdatedEvent = obj.orig;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.currentlyUpdatedEvent = null;
|
||||
this.$refs.calendar.clearOutCalendarEventEmphasis();
|
||||
this.$nextTick(() => {
|
||||
this.$refs.calendar.reloadEvents();
|
||||
});
|
||||
throw error;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -122,6 +122,8 @@ export function useEventLoader(
|
||||
allEvents.value = removeVisualForEventsLoading(
|
||||
ensureEventsAreInValidCacheRange(tempAllEvents),
|
||||
);
|
||||
|
||||
hasFirstLoadOccurred = true;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -130,6 +132,7 @@ export function useEventLoader(
|
||||
const reset = (arePreviousEventsCleared = true) => {
|
||||
if (arePreviousEventsCleared) {
|
||||
allEvents.value = [];
|
||||
hasFirstLoadOccurred = false;
|
||||
}
|
||||
reload(false);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user