-
Notifications
You must be signed in to change notification settings - Fork 7
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 causing infinite reloading loop in Chrome and Firefox #13
Comments
Hey @draykefriesen, super weird. Going to look into this, just wanted to thank you for opening the issue in the meantime! |
Hey @draykefriesen is it possible at all that you can show me a repo where this issue is happening? |
Having the same issue after using https://prismic.io/docs/technologies/preview-content-nextjs package_name: v0.1.2 |
Same problem, I noticed if I comment the redirectToPreviewURL on import { createClient, linkResolver } from '../../utils/prismicHelpers'
import * as prismicNext from '@prismicio/next'
export default async (req, res) => {
const client = createClient({ req })
await prismicNext.setPreviewData({ req, res })
// await prismicNext.redirectToPreviewURL({ req, res, client, linkResolver }) <- this line is causing an infinite reload
} So it probably has to be something wrong with this function? prismic-next/src/redirectToPreviewURL.ts Lines 75 to 95 in db8ca22
|
Hey, @dayhaysoos |
Maybe can be one problem that can cause this, but in my case Is still http because I'm using preview on localhost:3000 (as it's on the docs at this moment) |
Similar issue here. First preview is ok (toward a domain.localhost:3000, NextJS 12.1.4), I save and preview from prismic.io and can navigate to differents page without issue. Other issue, more nextJS side I think, is the fact that the preview feature seems not handling perfectly my _middleware that redirect / toward /dashboard if there is a JWT request.cookie. And so the prismic preview get me to / at first and require me to navigate again to /, to get the right /dashboard rewrite (by the _middleware handling). |
Hey everyone, thanks for the details. I will be looking into why this is happening and coming up with a solution. Could everyone provide me details about their app?
This will help me understand how Thanks! Some background info on why the infinite refresh happens: Prismic lets you share preview sessions with others by clicking the Get a sharable link button in the Prismic toolbar. This will only appear when you are in a preview session. When a users visits the shared preview link, the following happens:
If the Preview Mode cookie is not set in Step 5 for any reason, such as accessing the incorrect API endpoint, Steps 4-6 get stuck in an infinite loop. |
@jeremytenjo @guilhermefront @chamois-d-or @webda2l Could you try out a new alpha version, npm install @prismicio/next@alpha This version adds support for Thanks! |
No basePath, only a middleware as explain earlier.
Yes
No
No improvement on my side with a custom type 'container' case.
I succeed to preview once the page, but if I do a change & save from prismic.io, or press enter in the url address bar, it start looping. Because, on another case, with a more classic use of Prismic in the way of yours example projects and documentation, the preview works well as expected. :)
|
Still having the same problem.
We don't use basePath, but we have trailingSlash set to true (changing it to false didn't solve here)
Yes
No |
Hey everyone, I still have not been able to track down or reproduce this issue. Could someone (@webda2l or @guilhermefront?) share a project that gets stuck in an infinite loop during a preview? I'll need the following to test on my side:
If you would like to send this privately, you can send me a direct message on the Prismic community forum with this link: https://community.prismic.io/new-message?username=angeloashmore&title=@prismicio/next%20-%20GitHub%20Issue%2013 Thank you! |
Same issue here, infinite reloading the website. Tried with v0.1.2 and alpha v0.2. |
Hey everyone, after more investigations, it looks like the issue roots from the Prismic Toolbar, not necessarily A PR fixing two bugs was opened here: prismicio/prismic-toolbar#97 I am working toward getting the fix deployed. Once it is available, I'll post here again to ask everyone to test their previews again. Thank you for your patience! 🙏 |
Hey everyone, a quick update: The Prismic team is working on validating the toolbar PR link above before deploying publicly. Once it is available to test, I'll post here again. Thank you! |
Hey there, thank you all for your contribution and patience 🙏 The fixed toolbar was deployed at the beginning of July, you should no longer experience the above. If you still do, feel free to reopen this issue or open a new one :) |
Versions
Reproduction
Using preview in Chrome and Firefox causes infinite reloading loop. Works as expected in Safari.
Steps to reproduce
Create slicemachine Next.js project, and use this guide to set up Previews.
What is expected?
Preview to load once and not cause infinite reloading loop.
What is actually happening?
Preview is in infinite reloading loop.
The text was updated successfully, but these errors were encountered: