From 5e05048ba8a7e53c7a95bdd7bd472d957672296f Mon Sep 17 00:00:00 2001 From: Pinaki Bandyopadhyay Date: Sun, 26 Apr 2026 21:00:57 +0530 Subject: [PATCH] fix: unnecessary auth call --- src/components/auth-provider.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/auth-provider.tsx b/src/components/auth-provider.tsx index e051f0e..7d7c3ff 100644 --- a/src/components/auth-provider.tsx +++ b/src/components/auth-provider.tsx @@ -30,6 +30,13 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { const pathname = usePathname(); const fetchUser = async () => { + // Skip the backend call if the user doesn't even have the auth cookie + if (typeof document !== 'undefined' && !document.cookie.includes(AUTH_COOKIE_NAME)) { + setUser(null); + setLoading(false); + return; + } + try { const res = await fetch('/api/auth/me'); if (res.ok) {