fix: validate event start field when fetching calendar events

This commit is contained in:
Linus Rath
2026-03-20 17:11:36 +01:00
parent 6cff98ddb8
commit bd686c092c
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -110,10 +110,12 @@ export const useCalendarStore = create<CalendarStore>()(
fetchEvents: async (client, start, end) => {
set({ isLoadingEvents: true, error: null });
try {
const events = await client.queryAllCalendarEvents({
const rawEvents = await client.queryAllCalendarEvents({
after: start,
before: end,
});
// Filter out malformed events missing required 'start' field
const events = rawEvents.filter(e => typeof e.start === 'string' && e.start);
set({ events, isLoadingEvents: false, dateRange: { start, end } });
} catch (error) {
debug.error('Failed to fetch events:', error);