Gatsby - Prismic Previews REALLY SLOW loading times (latest gatsby x prismic)

Hi, I recently upgraded our sites codebase to use the latest gatsby x prismic and was able to "successfully" get everything "working" but we are now noticing unusually long load times (over 45 seconds to sometimes the browser prompting unable to load kill/wait).

I tried reverting back to the old way of previews where you setup the options in every template/page for previews instead of in the <PrismicPreviewProvider> and it FIXED the load times issue when testing locally.

Hoping to get things working with the latest patterns, is there anything I could be doing wrong? (Screenshots below. Please note commented out code is the newest preview pattern setup, and working code is old pattern setup)

Browser/SSR Gatsby page setup. Commented out is the newest setup.

404 page setup. Commented out is the newest setup

Preview page setup. Commented out is the newest setup

One of the template files setup. Commented out is the newest setup

1 Like

Hey @mattk, thanks for reaching out!

When exactly are you seeing these high load times? Is it after ding the project build?
Your setup looks just fine. Have you added the _previewable to your queries as well?

High load times are all the time. We have previews set up for Production build, Staging, and local dev environment, so it is not related to any specific time. Just seems to be with this setup. And yes we have added _previewable throughout our gql queries.

Maybe how I inserted the _previewable? Some queries have multiple different queries in 1 and I use a _previewable in each of them called like the screenshot below.

There's currently an open ticket about this on Github - Preview generation takes an unreasonably long time · Issue #500 · prismicio/prismic-gatsby · GitHub

2 Likes

Ah ok, much appreciated, thank you. Seems like it's an ongoing issue and best to stay with the old preview pattern for now.

Thanks for pointing out that GitHub issue @kris, it's a better way to follow up with open requests related to the plugin.