import { notFound } from "next/navigation" import { Suspense } from "react" import { getRecord } from "@/lib/records" import { RecordForm } from "../../_components/RecordForm" import { updateRecordAction } from "../../actions" export const metadata = { title: "编辑记录" } export default function EditRecordPage({ params }: PageProps<"/records/[id]">) { return (

编辑记录

{/* params are awaited inside Suspense so the shell can still be prerendered */} 加载中…

}>
) } async function EditRecordForm({ params }: Pick, "params">) { const { id } = await params const numericId = Number(id) // Guard against /records/abc: Number() would hand NaN to SQLite. if (!Number.isInteger(numericId) || numericId <= 0) notFound() const record = await getRecord(numericId) if (!record) notFound() return ( ) }