Avoid exec the getAvailability function when there are`t calendar selected (#9192)

Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-05-30 16:17:11 +02:00
1 parent cae1ca8dfb
commit 24ee3401af
1 file changed
+1
+1
View File
@@ -151,6 +151,7 @@ export const getCachedResults = async (
* TODO: Migrate credential type or appId
*/
const passedSelectedCalendars = selectedCalendars.filter((sc) => sc.integration === type);
if (!passedSelectedCalendars.length) return [];
/** We extract external Ids so we don't cache too much */
const selectedCalendarIds = passedSelectedCalendars.map((sc) => sc.externalId);
/** If we don't then we actually fetch external calendars (which can be very slow) */