1

I'm developing site with Gatsby and Prismic. I am implementing prismic preview with prismic-javascript. When click the preview on prismic, gatsby redirecting it to the proper URL but updated content not displaying now.

I tried to use the gatsby-source-prismic-preview plugin but it not worked.

const Preview = ({ history, location }) => {
  useEffect(() => {
    const params = qs.parse(location.search.slice(1))
    if (!params.token) {
      return console.warn(`No token available, check your configuration`)
    }

    client.previewSession(params.token, linkResolver, '/')
      .then(url => {
        navigate(url);
      })
      .catch(err => console.log(err))
  })
  return null
}

This is my preview page.

Please let me what is my mistake.

Pace
  • 15
  • 5
  • Have you checked this https://github.com/prismicio/prismic-gatsby/blob/main/packages/gatsby-plugin-prismic-previews/docs/migrating-from-gatsby-source-prismic.md ? – Aniruddha Shevle Jun 16 '23 at 02:44

1 Answers1

0

I'm not familiar with gatsby-source-prismic-preview but I'm not sure it's really up to date anymore. You should take a look at https://github.com/birkir/gatsby-source-prismic-graphql, It's the official plugin developed by the same guy that does gatsby-source-prismic-preview and it's backed up by the Prismic team. Maybe open an issue on GitHub if you don't feel like migrating to the new one.