fix(leads): await params Promise in lead detail page (Next.js 16)
Lead detail 500'd because params was accessed synchronously; Next 16 App Router passes params as a Promise. Same pattern already used correctly in /quote/[token]. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,15 +2,16 @@ import { notFound } from "next/navigation";
|
|||||||
import { getLeadById, getActivityLog, getUpcomingReminders } from "@/lib/lead-service";
|
import { getLeadById, getActivityLog, getUpcomingReminders } from "@/lib/lead-service";
|
||||||
import { LeadDetail } from "@/components/admin/leads/LeadDetail";
|
import { LeadDetail } from "@/components/admin/leads/LeadDetail";
|
||||||
|
|
||||||
export default async function LeadDetailPage({ params }: { params: { id: string } }) {
|
export default async function LeadDetailPage({ params }: { params: Promise<{ id: string }> }) {
|
||||||
const lead = await getLeadById(params.id);
|
const { id } = await params;
|
||||||
|
const lead = await getLeadById(id);
|
||||||
|
|
||||||
if (!lead) {
|
if (!lead) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
const activities = await getActivityLog(params.id);
|
const activities = await getActivityLog(id);
|
||||||
const reminders = await getUpcomingReminders(params.id);
|
const reminders = await getUpcomingReminders(id);
|
||||||
|
|
||||||
return <LeadDetail lead={lead} activities={activities} reminders={reminders} />;
|
return <LeadDetail lead={lead} activities={activities} reminders={reminders} />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user