import { createClient } from '@/lib/supabase/server'
import { HomeClient } from '@/components/HomeClient'

export const dynamic = "force-dynamic"

export default async function Home() {
  let user = null
  try {
    const supabase = await createClient()
    const { data } = await supabase.auth.getUser()
    user = data.user
  } catch (e) {
    console.error("Failed to fetch user in page.tsx:", e)
  }

  return <HomeClient initialUser={user} />
}