From b3f8465faed74d2d887d3f7b308ba1165cf3d854 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 22 Jan 2026 01:15:04 +0100 Subject: [PATCH] fix: force reload after auto-context switch --- lib/auth/context.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/auth/context.tsx b/lib/auth/context.tsx index eda4134..327696b 100644 --- a/lib/auth/context.tsx +++ b/lib/auth/context.tsx @@ -130,7 +130,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { if (result.success && result.user) { setUser(result.user) localStorage.setItem('user', JSON.stringify(result.user)) - router.refresh() + + // * Force hard reload to ensure browser sends new cookie to backend + // * router.refresh() is not enough for Client Components fetching data immediately + window.location.reload() } } catch (e) { console.error('Failed to auto-switch context', e)