Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Add to calendar feature not working properly (#20515)

Anik Dhabal Babu9600ab608568
diff --git a/packages/trpc/server/routers/loggedInViewer/setDestinationCalendar.handler.ts b/packages/trpc/server/routers/loggedInViewer/setDestinationCalendar.handler.ts
index 344f456b993..9f7e42bf4ce 100644
--- a/packages/trpc/server/routers/loggedInViewer/setDestinationCalendar.handler.ts
+++ b/packages/trpc/server/routers/loggedInViewer/setDestinationCalendar.handler.ts
@@ -81,7 +81,8 @@ export const setDestinationCalendarHandler = async ({ ctx, input }: SetDestinati
allCals.find(
(cal) =>
cal.primary &&
- (cal.credentialId === credentialId || cal.delegationCredentialId === delegationCredentialId)
+ (cal.credentialId === credentialId ||
+ (!!cal.delegationCredentialId && cal.delegationCredentialId === delegationCredentialId))
)?.email ?? null;
if (eventTypeId) {