From d5f337df80c56b8d87c583a7ea66c4200c9de984 Mon Sep 17 00:00:00 2001 From: Sean O'Connor Date: Wed, 14 Jan 2026 02:36:27 -0500 Subject: [PATCH] fix: hide mock in prod --- src/lib/auth-client.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/auth-client.ts b/src/lib/auth-client.ts index 0dbc7d4..0437e43 100644 --- a/src/lib/auth-client.ts +++ b/src/lib/auth-client.ts @@ -52,6 +52,16 @@ function getClient(): AuthClientType { // Export a Proxy that lazy-loads the client export const authClient = new Proxy({} as AuthClientType, { get(_target, prop) { + // Always ensure we're in the browser before accessing the client + if (typeof window === "undefined") { + // During SSR, return safe defaults for common properties + if (prop === "useSession") { + return () => ({ data: null, isPending: false, error: null }); + } + return undefined; + } + + // In the browser, get the real client const client = getClient(); const value = client[prop as keyof AuthClientType]; return typeof value === "function" ? value.bind(client) : value;