import { createClient } from "@/lib/supabase/server"
import type { KnowledgeItem } from "@/lib/types"
import { KnowledgeDashboard } from "@/components/knowledge-dashboard"

export const dynamic = "force-dynamic"

export default async function Page() {
  const supabase = await createClient()
  const { data } = await supabase
    .from("knowledge_items")
    .select("*")
    .order("created_at", { ascending: false })

  return <KnowledgeDashboard initialItems={(data ?? []) as KnowledgeItem[]} />
}
