Live Preview Error (Next.js w/ Rich Text field containing document link)

Summary: any document link used in a rich text field of a slice will break the live preview of that slice.

This looks like a bug to me, but it would be a pretty obvious one so I'm probably missing something.
It can be reproduced using the minimal Next starter GitHub - prismicio-community/nextjs-starter-prismic-minimal-ts: Start a project with Next.js, Prismic, and TypeScript.

Expected behavior:

  1. create a new project using starter
  2. enable live previews (lolcalhost)
  3. edit the homepage doc that gets created during the install
  4. see the live preview of the RichText default slice in the left column (the one with the text "Welcome to your new website! ...")

What happens instead of step 4:

Diagnosis:

  • the error is caused by the document link in the 5th bullet point (the one with the text: "This website has a homepage (pages/index.js) and a dynamic page (pages/[uid].js). The dynamic page will render pages with dynamic URLs, like this one.")
  • that is an internal link to the only other document in the install (titled "Another Page")
  • removing that link, saving and refreshing the page makes the live preview work again.
  • actually, any document link used in a rich text field of a slice will break the live preview of that slice.
  • normal links (by URL) do not cause any issues with live preview.

Please advise.
Thanks!

Hi @ovi, thanks for bringing this to our attention. The team is going to take a look and see what we can do here to fix the issue. I'll update this thread when I have more information.

Cheers,
Guy

Thanks for the reply, @guy.proops ! Important update: this only happens when previewing in localhost (the Live Preview URL is something like: http://localhost:3000). It works fine when previewing on a production URL (the live preview URL - i.e. using Vercel for Next.js).