fix: remove Better Auth useSession dependency from portal header
Some checks failed
Build and Deploy / build (push) Successful in 5m47s
Build and Deploy / deploy (push) Failing after 10s

Replace client-side useSession hook with server-side prop passing.
Portal layout fetches user email server-side and passes to header.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Lorentz 2026-02-16 13:02:14 +00:00
parent cdd897abbc
commit a123d5e394
2 changed files with 5 additions and 3 deletions

View file

@ -38,6 +38,7 @@ export default async function PortalLayout({
<div className="flex-1 pl-64">
<PortalHeader
companyName={activeCompany?.display_name}
userEmail={session.user.email}
isAdmin={isAdmin}
unreadNotifications={unreadNotifications}
/>

View file

@ -2,7 +2,7 @@
import { Bell, ChevronDown, LogOut, User } from 'lucide-react';
import { useRouter } from 'next/navigation';
import { signOut, useSession } from '@/lib/auth-client';
import { signOut } from '@/lib/auth-client';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
@ -16,17 +16,18 @@ import { Badge } from '@/components/ui/badge';
type PortalHeaderProps = {
companyName?: string;
userEmail?: string;
isAdmin?: boolean;
unreadNotifications?: number;
};
export function PortalHeader({
companyName,
userEmail,
isAdmin,
unreadNotifications = 0,
}: PortalHeaderProps) {
const router = useRouter();
const { data: session } = useSession();
const handleSignOut = async () => {
await signOut();
@ -82,7 +83,7 @@ export function PortalHeader({
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="flex items-center space-x-2">
<User className="h-5 w-5" />
<span className="hidden md:inline">{session?.user?.email}</span>
<span className="hidden md:inline">{userEmail}</span>
<ChevronDown className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>