diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue
index 9689c8c34..31835473c 100644
--- a/src/front/src/components/calendar_of_events/BigCalendar.vue
+++ b/src/front/src/components/calendar_of_events/BigCalendar.vue
@@ -35,7 +35,6 @@
diff --git a/src/front/src/components/calendar_of_events/UI_calendar/MiniCalendar.vue b/src/front/src/components/calendar_of_events/UI_calendar/MiniCalendar.vue
index 9ef676e54..5efd2ed71 100644
--- a/src/front/src/components/calendar_of_events/UI_calendar/MiniCalendar.vue
+++ b/src/front/src/components/calendar_of_events/UI_calendar/MiniCalendar.vue
@@ -1,5 +1,5 @@
-
+
@@ -56,7 +56,7 @@ import { useCalendarStore } from '@/store/calendarStore';
import { useAccountStore } from '@/store/AccountStore';
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
import SearchEvents from '@/components/calendar_of_events/UI_calendar/SearchEvents.vue';
-import { onMounted, watch, nextTick, ref } from 'vue';
+import { onMounted, watch, nextTick, ref, onBeforeUnmount } from 'vue';
import { storeToRefs } from 'pinia';
export default {
@@ -67,14 +67,10 @@ export default {
const accountStore = useAccountStore();
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
-
- // const selectedDate = computed(() => calendarStore.selectedDate);
- // const myCalendars = computed(() => calendarStore.myCalendars);
- // const subscribedCalendars = computed(() => calendarStore.subscribedCalendars);
-
const { user } = storeToRefs(accountStore);
const currentDisplay = ref(null);
+ let observer = null;
const handleDateClick = (date) => {
calendarStore.setSelectedDateFromPicker(date);
@@ -89,12 +85,6 @@ export default {
calendarStore.loadCalendars();
};
- onMounted(() => {
- loadCalendars();
-
- updateCalendarDays();
- });
-
// Реакция на изменения пользователя
watch(user, (newUser) => {
if (newUser) {
@@ -192,25 +182,24 @@ export default {
{ deep: true },
);
- // При смене месяца через кнопки навигации
- const observer = new MutationObserver((mutations) => {
- mutations.forEach((mutation) => {
- if (mutation.type === 'childList') {
- updateCalendarDays();
- }
- });
- });
-
onMounted(() => {
+ loadCalendars();
+ updateCalendarDays();
// Наблюдаем за изменениями в DOM date-picker
const datePicker = document.querySelector('.minCal');
if (datePicker) {
+ observer = new MutationObserver(() => updateCalendarDays());
observer.observe(datePicker, { childList: true, subtree: true });
}
});
+ onBeforeUnmount(() => {
+ observer?.disconnect();
+ });
+
return {
accountStore,
+ calendarStore,
user,
myCalendars,
subscribedCalendars,
@@ -225,16 +214,7 @@ export default {
};