Unverified Commit 2cf5d3a8 authored by Steven's avatar Steven Committed by GitHub

chore(docs): note cache-control header for preview/draft mode (#53825)

You can technically get similar ISR behavior setting the `Cache-Control` in `getServerSideProps()`, but this won't be automatically bypassed when enabling Preview Mode or Draft Mode so this PR adds that to the documentation.

x-ref: [slack discussion](https://vercel.slack.com/archives/C03S8ED1DKM/p1691514209722429)
parent 1286e145
...@@ -156,7 +156,9 @@ Then, send a request to `/api/disable-draft` to invoke the API Route. If calling ...@@ -156,7 +156,9 @@ Then, send a request to `/api/disable-draft` to invoke the API Route. If calling
### Works with `getServerSideProps` ### Works with `getServerSideProps`
Draft Mode works with `getServerSideProps` as well. It will also be available on the `context` object containing `draftMode` Draft Mode works with `getServerSideProps`, and is available as a `draftMode` key in the [`context`](/docs/pages/api-reference/functions/get-server-side-props#context-parameter) object.
> **Good to know**: You shouldn't set the `Cache-Control` header when using Draft Mode because it cannot be bypassed. Instead, we recommend using [ISR](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration).
### Works with API Routes ### Works with API Routes
......
...@@ -219,6 +219,8 @@ You can pass an object to `setPreviewData` and have it be available in `getStati ...@@ -219,6 +219,8 @@ You can pass an object to `setPreviewData` and have it be available in `getStati
The preview mode works on `getServerSideProps` as well. It will also be available on the `context` object containing `preview` and `previewData`. The preview mode works on `getServerSideProps` as well. It will also be available on the `context` object containing `preview` and `previewData`.
> **Good to know**: You shouldn't set the `Cache-Control` header when using Preview Mode because it cannot be bypassed. Instead, we recommend using [ISR](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration).
### Works with API Routes ### Works with API Routes
API Routes will have access to `preview` and `previewData` under the request object. For example: API Routes will have access to `preview` and `previewData` under the request object. For example:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment