Public available page shows preview version if res.revalidate('/some-page')
is called by a user with enabled preview mode
#38556
Labels
bug
Issue was opened via the bug report template.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
If a user with enabled preview mode is triggering an on-demand ISR from the same browser which has the preview-mode cookies set, the page get's build in preview mode and the preview-mode version of it is made publicly available via the CDN for all visitors
Expected Behavior
Only show preview mode to visitors which have preview mode enabled and ignore preview mode for requests which have been made via
res.revalidate
Link to reproduction
only on vercel, therefore no stackblitz
To Reproduce
1.) add
const {isPreview} = useRouter(); console.log(isPreview)
to any page of your next.js project2.) enable the preview mode for the current session via an API route and
res.setPreviewData({});
. The console.log is logging isPreview = true3.) trigger an ondemand isr with an API route and
res.revalidate('/some-page')
4.) open
/some-page
in a new private tab. Because we have no cookies the preview mode is disabled. But still the console.log will log isPreview = true because the page revalidation was triggered from an user with active preview modeThe text was updated successfully, but these errors were encountered: