# Preview doesn't show edits

**URL:** <https://community.prismic.io/t/preview-doesnt-show-edits/9322>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [March 9, 2022, 10:40pm UTC](https://community.prismic.io/t/preview-doesnt-show-edits/9322 "2022-03-09T22:40:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhayes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/dhayes/32/4082_2.png) [@dhayes](https://community.prismic.io/u/dhayes)\
**Post date:** [March 9, 2022, 10:40pm UTC](https://community.prismic.io/t/preview-doesnt-show-edits/9322/1 "2022-03-09T22:40:38Z")

</div>

I'm setting up Prismic on my project for the first time and I followed the new documentation on how to preview.

I see the toolbar when I click to preview it on my local environment but it doesn't show edits.

Would anyone know what might be going wrong? My code seems to match the documentation.

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [March 10, 2022, 7:23am UTC](https://community.prismic.io/t/preview-doesnt-show-edits/9322/3 "2022-03-10T07:23:03Z")

</div>

Hello @dhayes

Thanks for reaching out to us.

Could you please paste all your preview setup files here or send me a zip file?

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![dhayes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/dhayes/32/4082_2.png) [@dhayes](https://community.prismic.io/u/dhayes)\
**Post date:** [March 10, 2022, 6:16pm UTC](https://community.prismic.io/t/preview-doesnt-show-edits/9322/4 "2022-03-10T18:16:01Z")

</div>

There's one part that was on me. The preview endpoint in the Prismic dashboard wasn't set up correctly for NextJS. I fixed that to point to /api/preivew--so it wasn't sending the token in the first place.

However, now that it's hitting the preview endpoint it breaks completely:

 ![Screen Shot 2022-03-10 at 1.03.25 PM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/2/28146fb8a07910b482a29b0dd7483e9a824f0a01.jpeg)

Also, I can suppress the error but the preview API file also gives an error in the IDE.

 ![Screen Shot 2022-03-10 at 1.14.26 PM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/e/e995125789e68e2500d5a0cb04dc0c4348e03f3c.png)

---

<div class="post-metadata">

**Author:** ![dhayes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/dhayes/32/4082_2.png) [@dhayes](https://community.prismic.io/u/dhayes)\
**Post date:** [March 10, 2022, 8:01pm UTC](https://community.prismic.io/t/preview-doesnt-show-edits/9322/5 "2022-03-10T20:01:56Z")

</div>

Ok, I figured out why it isn't working and it seems to be fixed now. I'll describe the fix so others can hopefully get past this if they're starting fresh.

Basically, there are some errors in the Next.js "setup" documentation when it comes to the prismicio.js file.

On the setup page ([Set up Prismic with Next.js - Prismic](https://prismic.io/docs/technologies/setup-nextjs)) the documentation asks you to create the file and create the following createClient() function:

```auto
// This factory function allows smooth preview setup
export function createClient(config) {
  const client = prismic.createClient(endpoint, {
    ...config,
  })

  enableAutoPreviews({
    client,
    context: config.context,
    req: config.req,
  })

  return client
}

```

The problem it's missing "previewData" in the "enableAutoPreviews" section (it's also missing some optional chain operators which caused a different bug for me when setting up dynamic pages). The correct version is:

```auto
export function createClient(config) {
    const client = prismic.createClient(endpoint, {
        ...config,
    })

    enableAutoPreviews({
        client,
        previewData: config?.previewData,
        context: config?.context,
        req: config?.req,
    })

    return client
}

```

Once I fixed this the previews started working.

(Also for the issue of the "export default async (req, res)" IDE error I just went ahead and gave it the name "preview" so it would stop complaining.

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [March 11, 2022, 11:06am UTC](https://community.prismic.io/t/preview-doesnt-show-edits/9322/6 "2022-03-11T11:06:48Z")

</div>

Hello @dhayes

I am glad that the issue has been solved. Thank you so much for sharing feedback and working code snippets. I'll share with the team and make the necessary changes.

Thanks,  
Priyanka
