Does preview feature work only on un-generated page?

Hello eveyone, I have a question about preview feature.

I am currently working on nuxt with static page, and preview it is working well with SSR dev server.

However, I found that preview is not working with the pages already generated when I test after generate pages. I want to know if it is normal or not.

When I read nuxt documentation, it is normal but I started to have doubt when I see the video guide on prismic site.

thx in advance !

Hello @woolim

Welcome to the Prismic community and thanks for reaching out to us.

If I understood your question correctly it means that Preview is not working for published pages in your case. Previews should work with unpublished and published pages. Can you please share the documentation link with me where you read about it?

Also, what error do you get when you click on the preview for published pages?

I am looking forward to hearing from you back.

Thanks,
Priyanka

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Sorry for late. I saw this link (Nuxt - Preview Mode) and below article. Preview doesn't work on static build, but working perfectly with dev server.

=====================================================
Previewing pages that are not yet generated

For pages that are not yet generated, SPA fallback will still call the API before showing the 404 page as these pages exist on the API but are not generated yet.

Hello @woolim

Can you tell me if you have the fallback set up for Netlify in your Nuxt.config file?

Thanks for reply @Priyanka :slight_smile:
Yes, I setup fallback true in nuxt.config.js. The preview works perfectly on netlify for non-generated site because it fallback to SPA on 404 page.

But not for generated page. I've tested on my local, it has same problem as netlify env.
I can't see ONLY preview of non generated page.

Can you also make sure that you don't have modern set to true in the nuxt.config.js file?

modern: true

This has been known to cause issues:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Finally I found reason why preview was not working for generated pages.
It's because I didn't make prismic data as reactive.

My previous code was like this, it doesn't change content even though nuxt re-fetch all content because primary, items are seperated states in the component.

data() {
   return {
      primary: this.slice.primary,
      items: this.slice.items,
   }
}

So I changed data to computed and it works !

computed: {
  primary() { 
     return this.slice.primary
  },
  items() {
      return this.slice.items 
  }
}

I hope other people don't make stupid mistakes like me.ahah

2 Likes