Scheduling infrastructure for absolutely everyone.
fix: add name property to delegation credentials for type compatibility (#26022)
Volnei Munhoz3ccf001e1d98
diff --git a/apps/web/components/apps/MultiDisconnectIntegration.tsx b/apps/web/components/apps/MultiDisconnectIntegration.tsxindex 3b3c54327e0..5ecbecbdcc1 100644--- a/apps/web/components/apps/MultiDisconnectIntegration.tsx+++ b/apps/web/components/apps/MultiDisconnectIntegration.tsx@@ -39,7 +39,7 @@ export function MultiDisconnectIntegration({ credentials, onSuccess }: Props) {const mutation = trpc.viewer.credentials.delete.useMutation({onSuccess: () => {showToast(t("app_removed_successfully"), "success");- onSuccess && onSuccess();+ onSuccess?.();setConfirmationDialogOpen(false);},onError: () => {@@ -52,12 +52,12 @@ export function MultiDisconnectIntegration({ credentials, onSuccess }: Props) {},});- const getUserDisplayName = (user: (typeof credentials)[number]["user"]) => {+ const getUserDisplayName = (user: (typeof credentials)[number]["user"]): string | null => {if (!user) return null;- // Check if 'name' property exists on user- if ("name" in user) return user.name;- // Otherwise use email if available- if ("email" in user) return user.email;+ // Check if 'name' property exists and has a truthy string value+ if ("name" in user && typeof user.name === "string" && user.name) return user.name;+ // Otherwise use email if available and it's a string+ if ("email" in user && typeof user.email === "string" && user.email) return user.email;return null;};diff --git a/packages/app-store/delegationCredential.test.ts b/packages/app-store/delegationCredential.test.tsindex 8f35b14757e..0198402b233 100644--- a/packages/app-store/delegationCredential.test.ts+++ b/packages/app-store/delegationCredential.test.ts@@ -114,7 +114,7 @@ const buildDelegationCredential = (overrides = {}) => ({id: -1,delegatedToId: mockDelegationCredential.id,userId: mockUser.id,- user: { email: mockUser.email },+ user: { email: mockUser.email, name: null },key: { access_token: "NOOP_UNUSED_DELEGATION_TOKEN" },invalid: false,teamId: null,diff --git a/packages/app-store/delegationCredential.ts b/packages/app-store/delegationCredential.tsindex 979d493688e..1ef722e6a77 100644--- a/packages/app-store/delegationCredential.ts+++ b/packages/app-store/delegationCredential.ts@@ -87,6 +87,7 @@ const _buildCommonUserCredential = ({userId: user.id,user: {email: user.email,+ name: null as string | null,},key: {access_token: "NOOP_UNUSED_DELEGATION_TOKEN",