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

Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
This commit is contained in:
Efraín Rochín
2023-05-30 16:17:11 +02:00
committed by GitHub
co-authored by Joe Au-Yeung Hariom Balhara
parent cae1ca8dfb
commit 24ee3401af
+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) */