-
Notifications
You must be signed in to change notification settings - Fork 27.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preview does not work for existing, static paths #11298
Comments
We have a comprehensive test suite ensuring this feature works. Can you please provide more concrete reproduction steps and a full demo that doesn't work? |
Thanks for the quick reply @Timer. After trying to reproduce the bug in a clean setup I can confirm that it works as expected. 👍 Obviously this bug only occurs when beeing redirected by a third party (in my case prismic.io preview session). For some reason (and I am really struggling to figure out why), Accessing Redirect Response
Page Request (redirect target)
No |
Obviously this is not about Prismic. As soon as you have two sequenced redirects, the cookie won't be passed to the actual page: Redirect within one app ✅
Redirect from another app ❗️
Source code for the two apps:
|
It gets even stranger:
|
Cleared and condensed version can be found in #11304. |
I see the issue happening again, I am able to see the preview mode enabled on Dev mode (cookies are being set), but in Prod build, it doesn't work at all (No cookies set) |
After curl I found out that cookies are being set but in SameSite=None mode. Is that the issue?
|
@shinesingh1994 When testing this feature locally, you might wanna replace |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
When requesting a static path generated by
getStaticPaths
with preview mode on (by usingsetPreviewData
),getStaticProps
is called butcontext.preview
andcontext.previewData
are undefined.getStaticProps
is never called.A common scenario for this bug to occur is when:
To Reproduce
Expected behavior
Refering to the documention, I'd expect that (...)
(...) also for pages that are known to
getStaticPaths
and were already built.Workaround
Right now I am attaching a custom preview indicator when starting a preview session in
pages/api/preview.js
and redirecting to the corresponding post:In
pages/posts/[slug].js
due to the__preview__
indicator this URL was not pre-built bygetStaticPaths
and triggers afallback
call togetStaticProps
. Like this I use this indicator to identify preview modeThe text was updated successfully, but these errors were encountered: