Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/web/lib/components/admin/AdminSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import { usePathname, useRouter } from "next/navigation";
import {
Activity,
ArrowLeft,
Expand Down Expand Up @@ -128,10 +128,15 @@ export function AdminSidebar({
adminName,
}: AdminSidebarProps) {
const pathname = usePathname();
const router = useRouter();
const logout = useAuthStore((state) => state.logout);

function handleLogout() {
logout();
async function handleLogout() {
// AdminLayout is a Server Component — it does not re-render on client
// auth state changes. After signing out we must push to /admin/login
// ourselves, otherwise the admin chrome stays visible with stale data.
await logout();
router.replace("/admin/login");
}

return (
Expand Down
Loading