From 1c2595b15d30162eb2c2fb3f1b15c96388fb2a19 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 2 Aug 2023 09:25:54 -0700 Subject: [PATCH 1/8] Ensure router-server clean-up exits properly (#53495) x-ref: [slack thread](https://vercel.slack.com/archives/C059MNV0E1G/p1690980326674279) --- packages/next/src/server/lib/router-server.ts | 4 ++++ packages/next/src/server/lib/start-server.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/next/src/server/lib/router-server.ts b/packages/next/src/server/lib/router-server.ts index d1b9c08eafee9..940f515fff833 100644 --- a/packages/next/src/server/lib/router-server.ts +++ b/packages/next/src/server/lib/router-server.ts @@ -254,6 +254,10 @@ export async function initialize(opts: { }[]) { curWorker._child?.kill('SIGINT') } + + if (!process.env.__NEXT_PRIVATE_CPU_PROFILE) { + process.exit(0) + } } process.on('exit', cleanup) process.on('SIGINT', cleanup) diff --git a/packages/next/src/server/lib/start-server.ts b/packages/next/src/server/lib/start-server.ts index 3a060b82affbd..2f64779542d65 100644 --- a/packages/next/src/server/lib/start-server.ts +++ b/packages/next/src/server/lib/start-server.ts @@ -261,13 +261,13 @@ export async function startServer({ ) const cleanup = () => { debug('start-server process cleanup') - for (const curWorker of ((routerWorker as any)._workerPool?._workers || []) as { _child?: ChildProcess }[]) { curWorker._child?.kill('SIGINT') } + process.exit(0) } process.on('exit', cleanup) process.on('SIGINT', cleanup) From c3f4e5d866e4d29522d912865917e84b218e191f Mon Sep 17 00:00:00 2001 From: SubsequentlySneeds <118424338+SubsequentlySneeds@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:33:31 -0700 Subject: [PATCH 2/8] Minor grammar fix in "src Directory" page (#53481) This change removes the sentence fragment starting with "Which" and merges it into the previous sentence. --- .../07-configuring/06-src-directory.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-app/01-building-your-application/07-configuring/06-src-directory.mdx b/docs/02-app/01-building-your-application/07-configuring/06-src-directory.mdx index babc8381477dd..20a22f1f1b0c9 100644 --- a/docs/02-app/01-building-your-application/07-configuring/06-src-directory.mdx +++ b/docs/02-app/01-building-your-application/07-configuring/06-src-directory.mdx @@ -10,7 +10,7 @@ related: As an alternative to having the special Next.js `app` or `pages` directories in the root of your project, Next.js also supports the common pattern of placing application code under the `src` directory. -This separates application code from project configuration files which mostly live in the root of a project. Which is preferred by some individuals and teams. +This separates application code from project configuration files which mostly live in the root of a project, which is preferred by some individuals and teams. To use the `src` directory, move the `app` Router folder or `pages` Router folder to `src/app` or `src/pages` respectively. From 269114b5cc583f0c91e687c1aeb61503ef681b91 Mon Sep 17 00:00:00 2001 From: Jon Meyers Date: Thu, 3 Aug 2023 02:41:05 +1000 Subject: [PATCH 3/8] examples: implement server side auth with supabase (#53372) ### What? 1. Refactor `with-supabase` example to use server-side auth ### Why? 1. It is the recommended path for Next.js, and can serve as an example for the authentication docs ### How? 1. Move authentication methods from Client Component to Route Handlers --- .../app/_examples/protected-route/page.tsx | 83 ----------- .../with-supabase/app/auth/sign-in/route.ts | 33 +++++ .../with-supabase/app/auth/sign-out/route.ts | 17 +++ .../with-supabase/app/auth/sign-up/route.ts | 39 +++++ examples/with-supabase/app/login/messages.tsx | 23 +++ examples/with-supabase/app/login/page.tsx | 133 +++++------------- examples/with-supabase/app/page.tsx | 2 - .../with-supabase/components/LogoutButton.tsx | 26 +--- 8 files changed, 153 insertions(+), 203 deletions(-) delete mode 100644 examples/with-supabase/app/_examples/protected-route/page.tsx create mode 100644 examples/with-supabase/app/auth/sign-in/route.ts create mode 100644 examples/with-supabase/app/auth/sign-out/route.ts create mode 100644 examples/with-supabase/app/auth/sign-up/route.ts create mode 100644 examples/with-supabase/app/login/messages.tsx diff --git a/examples/with-supabase/app/_examples/protected-route/page.tsx b/examples/with-supabase/app/_examples/protected-route/page.tsx deleted file mode 100644 index b3df6cf820f1a..0000000000000 --- a/examples/with-supabase/app/_examples/protected-route/page.tsx +++ /dev/null @@ -1,83 +0,0 @@ -// TODO: Duplicate or move this file outside the `_examples` folder to make it a route - -import { - createServerActionClient, - createServerComponentClient, -} from '@supabase/auth-helpers-nextjs' -import { cookies } from 'next/headers' -import Image from 'next/image' -import { redirect } from 'next/navigation' - -export const dynamic = 'force-dynamic' - -export default async function ProtectedRoute() { - const supabase = createServerComponentClient({ cookies }) - - const { - data: { user }, - } = await supabase.auth.getUser() - - if (!user) { - // This route can only be accessed by authenticated users. - // Unauthenticated users will be redirected to the `/login` route. - redirect('/login') - } - - const signOut = async () => { - 'use server' - const supabase = createServerActionClient({ cookies }) - await supabase.auth.signOut() - redirect('/login') - } - - return ( -
-

- Supabase and Next.js Starter Template -

- -
-
- - Protected page - - - Hey, {user.email}! {' '} -
- -
-
-
-
- -
- Supabase Logo -
- Vercel Logo -
- -

- The fastest way to get started building apps with{' '} - Supabase and Next.js -

- -
- - Get started by editing app/page.tsx - -
-
- ) -} diff --git a/examples/with-supabase/app/auth/sign-in/route.ts b/examples/with-supabase/app/auth/sign-in/route.ts new file mode 100644 index 0000000000000..accb9465aa01a --- /dev/null +++ b/examples/with-supabase/app/auth/sign-in/route.ts @@ -0,0 +1,33 @@ +import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs' +import { cookies } from 'next/headers' +import { NextResponse } from 'next/server' + +export const dynamic = 'force-dynamic' + +export async function POST(request: Request) { + const requestUrl = new URL(request.url) + const formData = await request.formData() + const email = String(formData.get('email')) + const password = String(formData.get('password')) + const supabase = createRouteHandlerClient({ cookies }) + + const { error } = await supabase.auth.signInWithPassword({ + email, + password, + }) + + if (error) { + return NextResponse.redirect( + `${requestUrl.origin}/login?error=Could not authenticate user`, + { + // a 301 status is required to redirect from a POST to a GET route + status: 301, + } + ) + } + + return NextResponse.redirect(requestUrl.origin, { + // a 301 status is required to redirect from a POST to a GET route + status: 301, + }) +} diff --git a/examples/with-supabase/app/auth/sign-out/route.ts b/examples/with-supabase/app/auth/sign-out/route.ts new file mode 100644 index 0000000000000..658e5c7d626b3 --- /dev/null +++ b/examples/with-supabase/app/auth/sign-out/route.ts @@ -0,0 +1,17 @@ +import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs' +import { cookies } from 'next/headers' +import { NextResponse } from 'next/server' + +export const dynamic = 'force-dynamic' + +export async function POST(request: Request) { + const requestUrl = new URL(request.url) + const supabase = createRouteHandlerClient({ cookies }) + + await supabase.auth.signOut() + + return NextResponse.redirect(`${requestUrl.origin}/login`, { + // a 301 status is required to redirect from a POST to a GET route + status: 301, + }) +} diff --git a/examples/with-supabase/app/auth/sign-up/route.ts b/examples/with-supabase/app/auth/sign-up/route.ts new file mode 100644 index 0000000000000..f7d2aefe36fe0 --- /dev/null +++ b/examples/with-supabase/app/auth/sign-up/route.ts @@ -0,0 +1,39 @@ +import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs' +import { cookies } from 'next/headers' +import { NextResponse } from 'next/server' + +export const dynamic = 'force-dynamic' + +export async function POST(request: Request) { + const requestUrl = new URL(request.url) + const formData = await request.formData() + const email = String(formData.get('email')) + const password = String(formData.get('password')) + const supabase = createRouteHandlerClient({ cookies }) + + const { error } = await supabase.auth.signUp({ + email, + password, + options: { + emailRedirectTo: `${requestUrl.origin}/auth/callback`, + }, + }) + + if (error) { + return NextResponse.redirect( + `${requestUrl.origin}/login?error=Could not authenticate user`, + { + // a 301 status is required to redirect from a POST to a GET route + status: 301, + } + ) + } + + return NextResponse.redirect( + `${requestUrl.origin}/login?message=Check email to continue sign in process`, + { + // a 301 status is required to redirect from a POST to a GET route + status: 301, + } + ) +} diff --git a/examples/with-supabase/app/login/messages.tsx b/examples/with-supabase/app/login/messages.tsx new file mode 100644 index 0000000000000..17a2de3bf0d4f --- /dev/null +++ b/examples/with-supabase/app/login/messages.tsx @@ -0,0 +1,23 @@ +'use client' + +import { useSearchParams } from 'next/navigation' + +export default function Messages() { + const searchParams = useSearchParams() + const error = searchParams.get('error') + const message = searchParams.get('message') + return ( + <> + {error && ( +

+ {error} +

+ )} + {message && ( +

+ {message} +

+ )} + + ) +} diff --git a/examples/with-supabase/app/login/page.tsx b/examples/with-supabase/app/login/page.tsx index 016f31e0c98a8..8fdd5b57cd454 100644 --- a/examples/with-supabase/app/login/page.tsx +++ b/examples/with-supabase/app/login/page.tsx @@ -1,39 +1,7 @@ -'use client' - -import { useState } from 'react' -import { useRouter } from 'next/navigation' -import { createClientComponentClient } from '@supabase/auth-helpers-nextjs' import Link from 'next/link' +import Messages from './messages' export default function Login() { - const [email, setEmail] = useState('') - const [password, setPassword] = useState('') - const [view, setView] = useState('sign-in') - const router = useRouter() - const supabase = createClientComponentClient() - - const handleSignUp = async (e: React.FormEvent) => { - e.preventDefault() - await supabase.auth.signUp({ - email, - password, - options: { - emailRedirectTo: `${location.origin}/auth/callback`, - }, - }) - setView('check-email') - } - - const handleSignIn = async (e: React.FormEvent) => { - e.preventDefault() - await supabase.auth.signInWithPassword({ - email, - password, - }) - router.push('/') - router.refresh() - } - return (
{' '} Back - {view === 'check-email' ? ( -

- Check {email} to continue signing - up -

- ) : ( -
+ + + + + + -

- Don't have an account? - -

- - )} - {view === 'sign-up' && ( - <> - -

- Already have an account? - -

- - )} -
- )} + Sign Up + + +
) } diff --git a/examples/with-supabase/app/page.tsx b/examples/with-supabase/app/page.tsx index acf064173665b..d8ba2eed6211b 100644 --- a/examples/with-supabase/app/page.tsx +++ b/examples/with-supabase/app/page.tsx @@ -36,8 +36,6 @@ const examples = [ { type: 'Server Components', src: 'app/_examples/server-component/page.tsx' }, { type: 'Server Actions', src: 'app/_examples/server-action/page.tsx' }, { type: 'Route Handlers', src: 'app/_examples/route-handler.ts' }, - { type: 'Middleware', src: 'app/middleware.ts' }, - { type: 'Protected Routes', src: 'app/_examples/protected/page.tsx' }, ] export default async function Index() { diff --git a/examples/with-supabase/components/LogoutButton.tsx b/examples/with-supabase/components/LogoutButton.tsx index 0718feceb8c4c..776d6d58a7c81 100644 --- a/examples/with-supabase/components/LogoutButton.tsx +++ b/examples/with-supabase/components/LogoutButton.tsx @@ -1,25 +1,9 @@ -'use client' - -import { createClientComponentClient } from '@supabase/auth-helpers-nextjs' -import { useRouter } from 'next/navigation' - export default function LogoutButton() { - const router = useRouter() - - // Create a Supabase client configured to use cookies - const supabase = createClientComponentClient() - - const signOut = async () => { - await supabase.auth.signOut() - router.refresh() - } - return ( - +
+ +
) } From c7fa524ebd05be6fde9762bf1e298c2cff00cea2 Mon Sep 17 00:00:00 2001 From: Jarrett Meyer Date: Wed, 2 Aug 2023 13:02:51 -0400 Subject: [PATCH 4/8] docs: add clarity for deleting cookies (#52338) Added additional methods for deleting a cookie Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com> Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> --- .../02-api-reference/04-functions/cookies.mdx | 60 ++++++++++++++++--- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/docs/02-app/02-api-reference/04-functions/cookies.mdx b/docs/02-app/02-api-reference/04-functions/cookies.mdx index c9d88f79d985d..78570764a3379 100644 --- a/docs/02-app/02-api-reference/04-functions/cookies.mdx +++ b/docs/02-app/02-api-reference/04-functions/cookies.mdx @@ -85,26 +85,70 @@ async function create(data) { ## Deleting cookies -To "delete" a cookie, you must set a new cookie with the same name and an empty value. You can also set the `maxAge` to `0` to expire the cookie immediately. +> **Good to know**: You can only delete cookies in a [Server Action](/docs/app/building-your-application/data-fetching/server-actions) or [Route Handler](/docs/app/building-your-application/routing/route-handlers). + +There are several options for deleting a cookie: + +### `cookies().delete(name)` + +You can explicitly delete a cookie with a given name. + +```js filename="app/actions.js" +'use server' + +import { cookies } from 'next/headers' + +async function create(data) { + cookies().delete('name') +} +``` + +### `cookies().set(name, '')` + +Alternatively, you can set a new cookie with the same name and an empty value. + +```js filename="app/actions.js" +'use server' + +import { cookies } from 'next/headers' + +async function create(data) { + cookies().set('name', '') +} +``` > **Good to know**: `.set()` is only available in a [Server Action](/docs/app/building-your-application/data-fetching/server-actions) or [Route Handler](/docs/app/building-your-application/routing/route-handlers). +### `cookies().set(name, value, { maxAge: 0 })` + +Setting `maxAge` to 0 will immediately expire a cookie. + ```js filename="app/actions.js" 'use server' import { cookies } from 'next/headers' async function create(data) { - cookies().set({ - name: 'name', - value: '', - expires: new Date('2016-10-05'), - path: '/', // For all paths - }) + cookies().set('name', 'value', { maxAge: 0 }) +} +``` + +### `cookies().set(name, value, { expires: timestamp })` + +Setting `expires` to any value in the past will immediately expire a cookie. + +```js filename="app/actions.js" +'use server' + +import { cookies } from 'next/headers' + +async function create(data) { + const oneDay = 24 * 60 * 60 * 1000 + cookies().set('name', 'value', { expires: Date.now() - oneDay }) } ``` -You can only set cookies that belong to the same domain from which `.set()` is called. Additionally, the code must be executed on the same protocol (HTTP or HTTPS) as the cookie you want to update. +> **Good to know**: You can only delete cookies that belong to the same domain from which `.set()` is called. Additionally, the code must be executed on the same protocol (HTTP or HTTPS) as the cookie you want to delete. ## Version History From c5931a43d3ac81883567a7a2b499a839528b1f0b Mon Sep 17 00:00:00 2001 From: Kasper Andreassen <79222410+kasperadk@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:04:09 +0200 Subject: [PATCH 5/8] Update incorrect example link (#53472) ### What? The link to the demo in README.md for `example/cms-enterspeed`. ### Why? The link was pointing to the wrong demo. ### How? Updated the README.md. --- examples/cms-enterspeed/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cms-enterspeed/README.md b/examples/cms-enterspeed/README.md index f2c1807d172a3..0c686327ba898 100644 --- a/examples/cms-enterspeed/README.md +++ b/examples/cms-enterspeed/README.md @@ -4,7 +4,7 @@ This example showcases Next.js's [Static Generation](https://nextjs.org/docs/bas ## Demo -### [https://next-blog-wordpress.vercel.app](https://next-blog-wordpress.vercel.app) +### [https://next-blog-demo.enterspeed.com/](https://next-blog-demo.enterspeed.com/) ## Deploy your own From 480e3a3939b537e672ff0b896de6227bd0dfc4b2 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 2 Aug 2023 17:19:31 +0000 Subject: [PATCH 6/8] v13.4.13-canary.12 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-dev-overlay/package.json | 2 +- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lerna.json b/lerna.json index 7a4e9068110cb..cfb8070ecd472 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "13.4.13-canary.11" + "version": "13.4.13-canary.12" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 3eb4e6e5f6fd1..1f8cde22e7958 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 508832a8c6bd2..857a657018dcd 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "ESLint configuration used by NextJS.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "13.4.13-canary.11", + "@next/eslint-plugin-next": "13.4.13-canary.12", "@rushstack/eslint-patch": "^1.1.3", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0", "eslint-import-resolver-node": "^0.3.6", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 4e3f008537054..77eef4f55053e 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "ESLint plugin for NextJS.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 1c922f1b1f186..3f9385c2d3a21 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,6 +1,6 @@ { "name": "@next/font", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 14f54d9390e79..f92bd4184fa58 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index dcb23bd030670..e4ef9e12709de 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 07381f3f37d4c..dbafb7e762019 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index cd2550c55a597..31a305e22259a 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 8d5ff24b8ae13..35c29a090660b 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index c39dd7cbf150f..be9e9f3d7ba35 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 435b1b1c90731..8dd3f1a72bc82 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 03fc665f3a3d6..ffbd45dada752 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index e766014e30741..7ccbb7ddadfeb 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -83,7 +83,7 @@ ] }, "dependencies": { - "@next/env": "13.4.13-canary.11", + "@next/env": "13.4.13-canary.12", "@swc/helpers": "0.5.1", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", @@ -137,11 +137,11 @@ "@jest/types": "29.5.0", "@napi-rs/cli": "2.14.7", "@napi-rs/triples": "1.1.0", - "@next/polyfill-module": "13.4.13-canary.11", - "@next/polyfill-nomodule": "13.4.13-canary.11", - "@next/react-dev-overlay": "13.4.13-canary.11", - "@next/react-refresh-utils": "13.4.13-canary.11", - "@next/swc": "13.4.13-canary.11", + "@next/polyfill-module": "13.4.13-canary.12", + "@next/polyfill-nomodule": "13.4.13-canary.12", + "@next/react-dev-overlay": "13.4.13-canary.12", + "@next/react-refresh-utils": "13.4.13-canary.12", + "@next/swc": "13.4.13-canary.12", "@opentelemetry/api": "1.4.1", "@segment/ajv-human-errors": "2.1.2", "@taskr/clear": "1.1.0", diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 4b9b7a159498a..cf31a9c58c40b 100644 --- a/packages/react-dev-overlay/package.json +++ b/packages/react-dev-overlay/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-dev-overlay", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "A development-only overlay for developing React applications.", "repository": { "url": "vercel/next.js", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index f4735a49ed5a2..6d49ec092fc74 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index b6f01dbae6ff0..e86b57d2a3e21 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "13.4.13-canary.11", + "version": "13.4.13-canary.12", "private": true, "repository": { "url": "vercel/next.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 426fdd3f1e26c..64c4fc75d641a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -430,7 +430,7 @@ importers: packages/eslint-config-next: specifiers: - '@next/eslint-plugin-next': 13.4.13-canary.11 + '@next/eslint-plugin-next': 13.4.13-canary.12 '@rushstack/eslint-patch': ^1.1.3 '@typescript-eslint/parser': ^5.4.2 || ^6.0.0 eslint: ^7.23.0 || ^8.0.0 @@ -507,12 +507,12 @@ importers: '@jest/types': 29.5.0 '@napi-rs/cli': 2.14.7 '@napi-rs/triples': 1.1.0 - '@next/env': 13.4.13-canary.11 - '@next/polyfill-module': 13.4.13-canary.11 - '@next/polyfill-nomodule': 13.4.13-canary.11 - '@next/react-dev-overlay': 13.4.13-canary.11 - '@next/react-refresh-utils': 13.4.13-canary.11 - '@next/swc': 13.4.13-canary.11 + '@next/env': 13.4.13-canary.12 + '@next/polyfill-module': 13.4.13-canary.12 + '@next/polyfill-nomodule': 13.4.13-canary.12 + '@next/react-dev-overlay': 13.4.13-canary.12 + '@next/react-refresh-utils': 13.4.13-canary.12 + '@next/swc': 13.4.13-canary.12 '@opentelemetry/api': 1.4.1 '@segment/ajv-human-errors': 2.1.2 '@swc/helpers': 0.5.1 From a58a869f486828de91b5af4d02039f7c53dfaa9b Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Wed, 2 Aug 2023 19:58:07 +0200 Subject: [PATCH 7/8] (docs) Add example of redirection in Server Actions (#53485) Based on the feedback from #53435, this PR adds an example of redirection inside Server Actions to the docs. Currently, we have examples of getting/setting cookies but there's nothing for `redirect()`. --- .../02-data-fetching/03-server-actions.mdx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions.mdx b/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions.mdx index 05d3afa94291b..68203cf85c507 100644 --- a/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions.mdx +++ b/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions.mdx @@ -548,6 +548,22 @@ async function create(data) { } ``` +### Redirection + +You can also trigger a redirection within a Server Action by using the `redirect` function. + +```js highlight={8} +import { redirect } from 'next/navigation' + +async function addItem(data) { + 'use server' + + await saveToDb({ data }) + + redirect('/success') +} +``` + ## Glossary ### Actions From 57788b56f812ebf50c3fce796215c35ec63799bb Mon Sep 17 00:00:00 2001 From: John Ide Date: Wed, 2 Aug 2023 12:27:31 -0600 Subject: [PATCH 8/8] Adding docs about static exports not supporting dynamic segments (#52959) Adding docs about how Dynamic Segments aren't supported with Static Exports. - Related to https://github.com/vercel/next.js/issues/48022 Co-authored-by: Steven <229881+styfle@users.noreply.github.com> --- .../08-deploying/01-static-exports.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/02-app/01-building-your-application/08-deploying/01-static-exports.mdx b/docs/02-app/01-building-your-application/08-deploying/01-static-exports.mdx index 578a2f7352f84..2d92ff3a91d48 100644 --- a/docs/02-app/01-building-your-application/08-deploying/01-static-exports.mdx +++ b/docs/02-app/01-building-your-application/08-deploying/01-static-exports.mdx @@ -289,6 +289,7 @@ With this configuration, your application **will produce an error** if you try t The following additional dynamic features are not supported with a static export: +- [Dynamic Routes](https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes) without `generateStaticParams()` - `rewrites` in `next.config.js` - `redirects` in `next.config.js` - `headers` in `next.config.js`