mirror of
https://github.com/suitenumerique/messages.git
synced 2026-08-17 21:25:41 +02:00
review fix
This commit is contained in:
+9
-1
@@ -765,7 +765,15 @@ export const CalendarInvite = ({
|
||||
const match = calendars.find(calendarMatchesAttendee);
|
||||
return (match ?? calendars[0]).id;
|
||||
}, [calendars, calendarMatchesAttendee]);
|
||||
const effectiveCalendarId = selectedCalendarId ?? defaultCalendarId;
|
||||
// Ignore ``selectedCalendarId`` when it no longer matches any calendar
|
||||
// in the current list — otherwise a stale id (mailbox switch, calendar
|
||||
// deleted server-side) would flow into the RSVP/add-to-calendar POST
|
||||
// and the chooser display.
|
||||
const effectiveCalendarId =
|
||||
selectedCalendarId &&
|
||||
calendars.some((c) => c.id === selectedCalendarId)
|
||||
? selectedCalendarId
|
||||
: defaultCalendarId;
|
||||
|
||||
const selectedCalendar = useMemo(
|
||||
() => calendars.find((c) => c.id === effectiveCalendarId) ?? null,
|
||||
|
||||
Reference in New Issue
Block a user