From 155775556dcc5f11f1f9dbb6ad96d8166da724e6 Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Date: Mon, 21 Aug 2023 05:27:18 -0400 Subject: [PATCH] perf: GCal reduce calendar payload (#10853) --- packages/app-store/googlecalendar/lib/CalendarService.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/app-store/googlecalendar/lib/CalendarService.ts b/packages/app-store/googlecalendar/lib/CalendarService.ts index 5e51567233..b746233a43 100644 --- a/packages/app-store/googlecalendar/lib/CalendarService.ts +++ b/packages/app-store/googlecalendar/lib/CalendarService.ts @@ -352,7 +352,9 @@ export default class GoogleCalendarService implements Calendar { (selectedCalendarIds.length === 0 ? calendar.calendarList - .list() + .list({ + fields: "items(id)", + }) .then((cals) => cals.data.items?.map((cal) => cal.id).filter(Boolean) || []) : Promise.resolve(selectedCalendarIds) ) @@ -378,7 +380,6 @@ export default class GoogleCalendarService implements Calendar { }); return c; }, [] as Prisma.PromiseReturnType); - resolve(result); } ); @@ -400,7 +401,9 @@ export default class GoogleCalendarService implements Calendar { }); calendar.calendarList - .list() + .list({ + fields: "items(id,summary,primary,accessRole)", + }) .then((cals) => { resolve( cals.data.items?.map((cal) => {