[#168] added refresh to temp calendars when updating

This commit is contained in:
Camille Moussu
2025-10-15 15:20:15 +02:00
committed by Benoit TELLIER
parent 0f82711d7d
commit 29f984b347
10 changed files with 151 additions and 68 deletions
+13 -1
View File
@@ -48,6 +48,8 @@ import {
getTimezoneOffset,
resolveTimezone,
} from "../../components/Calendar/TimezoneSelector";
import { getCalendarRange } from "../../utils/dateUtils";
import { refreshCalendars } from "../../components/Event/utils/eventUtils";
// Helper component for field with label
const FieldWithLabel = React.memo(
@@ -123,6 +125,7 @@ function EventPopover({
const organizer = useAppSelector((state) => state.user.organiserData);
const userId =
useAppSelector((state) => state.user.userData?.openpaasId) ?? "";
const tempList = useAppSelector((state) => state.calendars.templist);
const selectPersonnalCalendars = createSelector(
(state) => state.calendars,
(calendars) =>
@@ -398,12 +401,21 @@ function EventPopover({
resetAllStateToDefault();
// Save to API in background
dispatch(
await dispatch(
putEventAsync({
cal: userPersonnalCalendars[calendarid],
newEvent,
})
);
if (tempList) {
const calendarRange = getCalendarRange(new Date(start));
refreshCalendars(
dispatch,
Object.values(tempList),
calendarRange,
"temp"
);
}
};
const dialogActions = (