# Previews and next.js

**URL:** <https://community.prismic.io/t/previews-and-next-js/7891>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [November 16, 2021, 8:41am UTC](https://community.prismic.io/t/previews-and-next-js/7891 "2021-11-16T08:41:40Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/rob1/32/9074_2.png) [@rob1](https://community.prismic.io/u/rob1)\
**Post date:** [November 16, 2021, 8:41am UTC](https://community.prismic.io/t/previews-and-next-js/7891/1 "2021-11-16T08:41:40Z")

</div>

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.

 ![Screen Shot 2021-11-16 at 9.23.05 PM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/3/35912df7190965a2d82ed9ce3c37dccc67cce2aa.png)

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

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 16, 2021, 3:03pm UTC](https://community.prismic.io/t/previews-and-next-js/7891/5 "2021-11-16T15:03:50Z")

</div>

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:

> **[Previews with Next.js](https://prismic.io/docs/technologies/previews-nextjs)**
>
> This article will show you how to preview content changes without publishing your document or rebuilding your project.

We've implemented this in the blog project:

> **[GitHub - prismicio/nextjs-blog](https://github.com/prismicio/nextjs-blog)**
>
> Contribute to prismicio/nextjs-blog development by creating an account on GitHub.

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

Thanks.

---

<div class="post-metadata">

**Author:** ![rob1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/rob1/32/9074_2.png) [@rob1](https://community.prismic.io/u/rob1)\
**Post date:** [November 17, 2021, 9:25am UTC](https://community.prismic.io/t/previews-and-next-js/7891/6 "2021-11-17T09:25:21Z")

</div>

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.

 ![Screen Shot 2021-11-17 at 7.02.53 PM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/4/4a0318814ffc91b5e92f958d80c82f95582ce71d.png)

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 17, 2021, 10:17am UTC](https://community.prismic.io/t/previews-and-next-js/7891/7 "2021-11-17T10:17:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [December 1, 2021, 5:39pm UTC](https://community.prismic.io/t/previews-and-next-js/7891/8 "2021-12-01T17:39:24Z")

</div>

Threads close after a period of inactivity. [Flag this thread](https://community.prismic.io/t/re-open-a-thread/2175) to re-open it and continue the conversation.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 6, 2021, 11:43pm UTC](https://community.prismic.io/t/previews-and-next-js/7891/9 "2021-12-06T23:43:03Z")

</div>



---

<div class="post-metadata">

**Author:** ![rob1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/rob1/32/9074_2.png) [@rob1](https://community.prismic.io/u/rob1)\
**Post date:** [January 19, 2022, 8:18am UTC](https://community.prismic.io/t/previews-and-next-js/7891/10 "2022-01-19T08:18:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [January 20, 2022, 4:42pm UTC](https://community.prismic.io/t/previews-and-next-js/7891/12 "2022-01-20T16:42:51Z")

</div>

Hey Rob,

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

Thanks.

---

<div class="post-metadata">

**Author:** ![rob1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/rob1/32/9074_2.png) [@rob1](https://community.prismic.io/u/rob1)\
**Post date:** [January 20, 2022, 7:30pm UTC](https://community.prismic.io/t/previews-and-next-js/7891/13 "2022-01-20T19:30:58Z")

</div>

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](mailto:rob@andnow.co.nz)

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [January 21, 2022, 11:21am UTC](https://community.prismic.io/t/previews-and-next-js/7891/14 "2022-01-21T11:21:08Z")

</div>

Hi Rob,

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

Thanks.

---

<div class="post-metadata">

**Author:** ![rob1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/rob1/32/9074_2.png) [@rob1](https://community.prismic.io/u/rob1)\
**Post date:** [March 13, 2022, 10:01am UTC](https://community.prismic.io/t/previews-and-next-js/7891/16 "2022-03-13T10:01:19Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [March 14, 2022, 10:44am UTC](https://community.prismic.io/t/previews-and-next-js/7891/18 "2022-03-14T10:44:20Z")

</div>

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:

> **[@prismicio/client v6 Migration Guide](https://prismic.io/docs/technologies/prismic-client-v6-migration-guide)**
>
> This is a guide for upgrading a project using @prismicio/client v5 to @prismicio/client v6.

> **[@prismicio/react v2 Migration Guide](https://prismic.io/docs/technologies/prismic-react-v2-migration-guide)**
>
> This is a guide for upgrading a project using prismic-reactjs v1 to @prismicio/react v2.

> **[next-slicezone Deprecation Guide](https://prismic.io/docs/technologies/next-slicezone-deprecation-guide)**
>
> next-slicezone is deprecated. Its functionalities have been delegated to two other packages: @prismicio/client and @prismicio/react.

Thanks.
