diff --git a/src/actions/index.ts b/src/actions/index.ts index 25a5005..4d59494 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts @@ -10,6 +10,7 @@ export async function editSnippet(id: number, code: string) { data: { code }, }); + revalidatePath(`/snippets/${id}`); redirect(`/snippets/${id}`); } diff --git a/src/app/snippets/[id]/page.tsx b/src/app/snippets/[id]/page.tsx index 7f1495e..4719919 100644 --- a/src/app/snippets/[id]/page.tsx +++ b/src/app/snippets/[id]/page.tsx @@ -47,3 +47,13 @@ export default async function SnippetShowPage(props: SnippetShowPageProps) { ); } + +export async function generateStaticParams() { + const snippets = await db.snippet.findMany(); + + return snippets.map((snippet) => { + return { + id: snippet.id.toString(), + }; + }); +}