From 61ad71e141ab08487eec08e76244d7d6e51b15c6 Mon Sep 17 00:00:00 2001 From: samcx Date: Fri, 12 Apr 2024 18:03:46 -0400 Subject: [PATCH 1/3] docs(closures): switch onClick to formAction --- .../02-data-fetching/02-server-actions-and-mutations.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx b/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx index eeeef2f3620d0..30a91c409edd5 100644 --- a/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx +++ b/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx @@ -934,7 +934,6 @@ export default function Page() { ``` ```jsx filename="app/page.js" switcher -'use client' export default function Page() { const publishVersion = await getLatestVersion(); @@ -946,7 +945,7 @@ export default function Page() { ... } - return ; + return ; } ``` From 2683b11c70be5f2a215baeeb3ea02053a18c9a01 Mon Sep 17 00:00:00 2001 From: samcx Date: Fri, 12 Apr 2024 18:19:42 -0400 Subject: [PATCH 2/3] docs: add async to snippet --- .../02-data-fetching/02-server-actions-and-mutations.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx b/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx index 30a91c409edd5..9fce927281858 100644 --- a/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx +++ b/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx @@ -934,7 +934,7 @@ export default function Page() { ``` ```jsx filename="app/page.js" switcher -export default function Page() { +export default async function Page() { const publishVersion = await getLatestVersion(); async function publish() { From 7834d3ec55e1edbc0b3cf26d8b21e7e5546a61bd Mon Sep 17 00:00:00 2001 From: samcx Date: Fri, 12 Apr 2024 18:20:24 -0400 Subject: [PATCH 3/3] docs: add async --- .../02-data-fetching/02-server-actions-and-mutations.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx b/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx index 9fce927281858..72e3beef4dd20 100644 --- a/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx +++ b/docs/02-app/01-building-your-application/02-data-fetching/02-server-actions-and-mutations.mdx @@ -918,7 +918,7 @@ Defining a Server Action inside a component creates a [closure](https://develope ```tsx filename="app/page.tsx" switcher 'use client' -export default function Page() { +export default async function Page() { const publishVersion = await getLatestVersion(); async function publish(formData: FormData) {