diff --git a/src/app/dashboard/[fileid]/page.tsx b/src/app/dashboard/[fileid]/page.tsx index 752a120..bd9d449 100644 --- a/src/app/dashboard/[fileid]/page.tsx +++ b/src/app/dashboard/[fileid]/page.tsx @@ -1,6 +1,6 @@ import PdfSummary from "@/components/PdfSummary"; import PdfRenderer from "@/components/PdfRenderer"; -import { fetchReport } from "@/lib/actions/report.actions"; // Import your fetchReport function +import { fetchReport, fetchAllReportIds } from "@/lib/actions/report.actions"; // Import your fetch functions interface PageProps { params: { @@ -8,13 +8,22 @@ interface PageProps { }; } +export async function generateStaticParams() { + // Fetch all the report IDs that you want to pre-generate static pages for + const reportIds = await fetchAllReportIds(); + + // Return an array of params, each containing a report ID + return reportIds.map((id) => ({ + fileid: id, + })); +} + const Page = async ({ params }: PageProps) => { const { fileid } = params; // Fetch the report using the fileid const report = await fetchReport(fileid); - // Check if the report is found, and if not, you can handle it (e.g., show an error message) if (!report) { return (