From 6e16d4f2c814957a35e81445b04863b41bda5775 Mon Sep 17 00:00:00 2001 From: "santasri.pachhal" Date: Tue, 23 Jun 2026 23:19:09 +0530 Subject: [PATCH] fix(auth): clear query cache when user logs out from nav menu --- src/components/nav-user.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/nav-user.tsx b/src/components/nav-user.tsx index 86342f6..289e30f 100644 --- a/src/components/nav-user.tsx +++ b/src/components/nav-user.tsx @@ -9,6 +9,7 @@ import { Sparkles, } from 'lucide-react'; import { useRouter } from 'next/navigation'; +import { useQueryClient } from '@tanstack/react-query'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { @@ -43,6 +44,7 @@ export function NavUser({ }) { const { isMobile } = useSidebar(); const router = useRouter(); + const queryClient = useQueryClient(); const clearAuth = useAuthStore((state) => state.logout); const clearApp = useAppStore((state) => state.clear); const [isLoggingOut, setIsLoggingOut] = useState(false); @@ -57,6 +59,7 @@ export function NavUser({ } catch { // Local logout should still complete if the server session is already invalid. } finally { + queryClient.clear(); clearAuth(); clearApp(); router.replace(ROUTES.LOGIN);