From f03a0b9c8d6c69e8a4009506317b3810a6c0937e Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 30 Sep 2025 08:30:40 +0000 Subject: [PATCH] Add linkedProviders memo and include in context value cgen-f4e79ce94d5e4e51848e88c9a514f57e --- client/contexts/AuthContext.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 14e5a6d8..32bd3b77 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -437,6 +437,19 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ if (user?.id) await fetchUserProfile(user.id); }; + const linkedProviders = useMemo(() => { + const supported: SupportedOAuthProvider[] = ["github", "google"]; + if (!user?.identities) return []; + return (user.identities as any[]) + .filter((identity) => supported.includes(identity.provider)) + .map((identity) => ({ + provider: identity.provider as SupportedOAuthProvider, + identityId: identity.identity_id, + linkedAt: identity.created_at, + lastSignInAt: identity.last_sign_in_at, + })); + }, [user]); + const computedComplete = checkProfileComplete(profile) || (typeof window !== "undefined" && @@ -449,9 +462,12 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ session, loading, profileComplete: computedComplete, + linkedProviders, signIn, signUp, signInWithOAuth, + linkProvider, + unlinkProvider, signOut, updateProfile, refreshProfile,