From f270b293c83accb53f4b697f3660ff685d17192c Mon Sep 17 00:00:00 2001 From: Arthur Denner Date: Mon, 22 Aug 2022 19:32:56 +0200 Subject: [PATCH 1/2] Mention router.isPreview on Preview Mode page --- docs/advanced-features/preview-mode.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/advanced-features/preview-mode.md b/docs/advanced-features/preview-mode.md index a6700718692d..2bb523c47282 100644 --- a/docs/advanced-features/preview-mode.md +++ b/docs/advanced-features/preview-mode.md @@ -223,6 +223,10 @@ export default function myApiRoute(req, res) { } ``` +### Works with the router + +The `useRouter` hook returns an `isPreview` boolean. + ### Unique per `next build` Both the bypass cookie value and the private key for encrypting the `previewData` change when `next build` is completed. From 8c2cef877b76a3627d2e3996a5cfb2725c45adf0 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 22 Aug 2022 14:40:05 -0500 Subject: [PATCH 2/2] apply suggestion --- docs/advanced-features/preview-mode.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/advanced-features/preview-mode.md b/docs/advanced-features/preview-mode.md index 2bb523c47282..e9cd56f40f61 100644 --- a/docs/advanced-features/preview-mode.md +++ b/docs/advanced-features/preview-mode.md @@ -173,6 +173,8 @@ https:///api/preview?secret=&slug= ## More Details +> **Note**: during rendering `next/router` exposes an `isPreview` flag, see the [router object docs](/docs/api-reference/next/router.md#router-object) for more info. + ### Clear the Preview Mode cookies By default, no expiration date is set for Preview Mode cookies, so the preview session ends when the browser is closed. @@ -223,10 +225,6 @@ export default function myApiRoute(req, res) { } ``` -### Works with the router - -The `useRouter` hook returns an `isPreview` boolean. - ### Unique per `next build` Both the bypass cookie value and the private key for encrypting the `previewData` change when `next build` is completed.