From 92401c53245d4f026d1717b8a0c4fadb1e6ea340 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Tue, 2 Dec 2025 12:40:15 +0000 Subject: [PATCH] Fix home page redirect for unauthenticated users - Check session before calling getLists() - Redirect to login page if not authenticated - Prevents server component render error in production --- app/page.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/page.tsx b/app/page.tsx index fcea3fc..cbbcefd 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -5,12 +5,19 @@ import GlobalSearch from '@/components/GlobalSearch' import EmptyState from '@/components/EmptyState' import Link from 'next/link' import { auth } from '@/auth' +import { redirect } from 'next/navigation' export const dynamic = 'force-dynamic' export default async function Home() { - const lists = await getLists() const session = await auth() + + // Redirect to login if not authenticated + if (!session?.user) { + redirect('/auth/login') + } + + const lists = await getLists() return (