prismicio/prismic-next

exitPreview() is not working

Closed this issue · 3 comments

Packages version:

"@prismicio/client": "^6.7.1",
    "@prismicio/helpers": "^2.3.5",
    "@prismicio/next": "^0.1.5",
    "@prismicio/react": "^2.4.4",

api/exit-preview.js is as follows:

import { exitPreview } from "@prismicio/next"

export default async function exit(req, res) {
  await exitPreview({ res, req })
}

Steps to reproduce:

  • Preview a page
  • Open preview - preview works
  • click on exit preview in the toolbar
  • toolbar is gone but the preview data is still there!

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

  • Information about your environment and packages you use (Node.js version, package names and their versions, etc.)
    Feel free to attach a copy of your package.json file.
  • Any troubleshooting steps you already went through
  • A minimal reproduction of the issue, and/or instructions on how to reproduce it

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request address it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team

Hey @kb1995, I was away on vacation but I'm back now. 🙂

There was a bug in @prismicio/next that caused this exact issue when deploying to CDNs that aggressively cache API route responses, including Vercel. This is fixed as of v0.1.4 where exitPreview() now returns a 205 status code.

For more details on the issue and the fix, see #32.

I see you're using at least v0.1.5, which already includes the fix, so you may have a cached response stored in your browser. Could you clear your browser cache (specifically for the /api/exit-preview route) and try again? You should see a 205 status code on the /api/exit-preview route, not a 200.

Please let me know if this fixes the issue. Thanks!

I'm going to close this issue as it has become stale, but feel free to reply here. We can continue the discussion and re-open if necessary. Thanks! 🙂