-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure On-Demand revalidate does not consider preview cookie (#39313)
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default function handler(req, res) { | ||
res.setPreviewData({ hello: 'world' }) | ||
res.json({ enabled: true }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export function getStaticProps({ preview, previewData }) { | ||
return { | ||
props: { | ||
preview: preview || false, | ||
previewData: previewData || null, | ||
}, | ||
} | ||
} | ||
|
||
export default function Page(props) { | ||
return ( | ||
<> | ||
<p id="page">/preview</p> | ||
<p id="props">{JSON.stringify(props)}</p> | ||
</> | ||
) | ||
} |