From e7539468c106a58c80ec2bdc2f8ddd5e715e6fa9 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 17 May 2026 11:03:54 +0530 Subject: [PATCH] Fix FamilyProvider admin check - move inside useEffect Co-Authored-By: Claude Opus 4.7 --- src/app/FamilyProvider.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/FamilyProvider.tsx b/src/app/FamilyProvider.tsx index 6958779..82a92ec 100644 --- a/src/app/FamilyProvider.tsx +++ b/src/app/FamilyProvider.tsx @@ -49,13 +49,14 @@ export function FamilyProvider({ children: providerChildren }: { children: React const [memberCount, setMemberCount] = useState(2); useEffect(() => { - // Skip family check for admin pages - if (typeof window !== "undefined" && window.location.pathname.startsWith("/admin")) { - setLoading(false); - return; - } - async function fetchFamilyData() { + // Skip family check for admin pages + const path = window.location.pathname; + if (path.startsWith("/admin") || path === "/admin-login") { + setLoading(false); + return; + } + try { // Get current session from database const sessionRes = await fetch("/api/auth/signin");