fix: directly delete recurring events when converting to non-recurring

- Use direct API call to delete recurring events instead of going through Redux store
- Construct event URL directly for more reliable deletion
- Add error handling and small delay to ensure complete deletion
- Clean up all instances from store after deletion
This commit is contained in:
lenhanphung
2025-10-09 14:05:19 +07:00
committed by Benoit TELLIER
parent 2ba80fcdb6
commit 40f0179be6
3 changed files with 89 additions and 65 deletions
+5 -5
View File
@@ -46,7 +46,7 @@ import {
import { Calendars } from "../Calendars/CalendarTypes";
import { userAttendee } from "../User/userDataTypes";
import { getEvent } from "./EventApi";
import { formatLocalDateTime } from "./EventModal";
import { formatLocalDateTime } from "../../components/Event/EventFormFields";
import { CalendarEvent, RepetitionObject } from "./EventsTypes";
export default function EventDisplayModal({
@@ -128,7 +128,7 @@ export default function EventDisplayModal({
onClose({}, "backdropClick");
}
setRepetition(event?.repetition ?? ({} as RepetitionObject));
}, [open, eventId, dispatch, onClose, event]);
}, [open, eventId, dispatch, onClose, event, calendar]);
useEffect(() => {
const fetchMasterEvent = async () => {
const masterEvent = await getEvent(event);
@@ -160,8 +160,8 @@ export default function EventDisplayModal({
calId,
title,
URL: event.URL ?? `/calendars/${calId}/${newEventUID}.ics`,
start: new Date(start),
end: new Date(end),
start: start,
end: end,
allday,
uid: event.uid ?? newEventUID,
description,
@@ -523,7 +523,7 @@ export default function EventDisplayModal({
{isOwn && (
<RepeatEvent
repetition={repetition}
eventStart={event.start}
eventStart={new Date(event.start)}
setRepetition={setRepetition}
isOwn={isOwn && typeOfAction !== "solo"}
/>