Previews and next.js

Hi I'm getting this error on my project when I preview locally. I used the next.js multi-lang template as as a starter and everything works fine apart from previews.

When I hit preview from prismic it loads the correct page then It then constantly refreshes that page and the error.

I'm not sure how I get to push the required dynamic files into the .next cached area.

Hi Rob,

I think that project is a bit outdated in terms of the preview functionality, it's in our backlog to update.

The best thing to do for now is to follow the latest Previews documentation:

We've implemented this in the blog project:

Let me know how that goes or if you have further questions.

Thanks.

Hey Phil thanks for the heads up yes the blog example makes more sense I have reworked the code and previews run ... what's interesting is that it borks on the exit preview then refreshes and I can see the changes pre publish but it refreshes two or three times before that happens and exit preview disapears. Although it works I'd like to tidy this up so it doesn't refresh three times.

Hey Rob,

Yeah unfortunately this strange 'bork' on exit previews where it talks about chunks has appeared in the last few releases of Next.js and we're not exactly sure why. I'm still investigating as to what is causing that strange behaviour, once I figure it out I'll get back to you.

Thanks.

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.

Hi Phil

I have this strange issue on previews where the preview loads then times out and shows the existing content after about a second. It's running next.js - I've flushed the cookie etc any ideas?

Thanks

Rob

Hey Rob,

If you run click the preview button in Prismic a second time without closing the window does the preview work?

Thanks.

No same thing

You can test in my Tautahi repository - use the staging preview link

R

Rob Brough
Founder / CTO
And Now Limited

+64 27 659 4075
rob@andnow.co.nz

Hi Rob,

I actually don't have access to your repo, can you send me a screen recording of the issue?

Thanks.

Hey Phil been working on this - have previews running.

Only thing is that when the preview window is open... and I save in Prismic it bounces the preview window to the home page. If I preview again it works.

I'm not using the latest still using prismic.io 5.1 - any ideas? I see docs have upgraded to 6 in the last few days. Do we have a work around for 5.1 or should I do a full upgrade?

Thanks

R

Hey Rob,

There's no workaround for the behaviour you described above. If you want to do an upgrade we have a few migration guides to help:

Thanks.