Preview Support

Is preview and the toolbar supported on the OOB Nuxt/SM project? When I hit preview the correct page loads but not with the updated content or the toolbar. I created a preview in my settings pointing to the localhost and with "/preview" in the link resolver field.

Hello Shawn, yes, previews work with SM nuxt projects.

To be able to do a test on my side, could you tell me:

  • Which browser are you using, and if its Chrome, the current version installed on your machine?
  • The URL of your repository

You can send this info to me in a private dm if your prefer.

Thanks a lot

Hey Shawn,

There seems to be an issue with previews for SM repositories. It seems to be on Chrome and we think it's to do with a cookie policy issue, we rolled out a fix previously on other groups. We're looking in to it and we'll update you here once we know more.

Thanks.

@Phil : Thanks for looking into that. I am happy to hear it is not me. lol. I am in fact using Chrome. I will check with another browser. Please keep me informed.

edit: I tried in Edge and Safari as well and still was not getting the toolbar or the updated content.

1 Like

Hi Phil,
I have the same problem.
No toolbar visible and the preview works but with not the saved (updated) content.
I send you my prismic rep in dm

Hey Benoit,

We are working on the fix for this and it should be done soon. I'll let you know when this is done.

1 Like

Hey Benoit,

This was fixed last week can you confirm?

Hi Phil,
I have the same problem, no update of the content in the preview.
Also in the toolbar iframe, the html is empty.
Could you check if my config is ok ?

Can you send me the github link for your project so I can test this?

Hi Phil,
I sent you a pm

1 Like

@benoit.jollivet I checked out your project and I was able to preview fine on your homepage. I removed the preview route from the link resolver and preview: "/preview", from the nuxt.config as these aren't necessary.

Though when I tried to visit the page route http://192.168.1.50:8000/styleguide without preview I got the following error:

TypeError

Cannot read property 'resolver' of undefined

Which I don't really understand, but I saw you had <slice-zone type="page" :uid="uid" /> instead of <slice-zone type="page" :uid="$route.params.uid" />

It works fine on the job page though:

So there doesn't seem to be any preview problems.

We resolved your other issue with some investigation too, thanks @hugo.villain.

In the modules of your nuxt.config you have an array inside and array. So you have:

  modules: [
    [
      "@nuxtjs/prismic",
      "@nuxtjs/google-analytics",
      "@nuxtjs/sitemap",
      "nuxt-sm",
    ],
  ],

Instead of...

  modules: [
      "@nuxtjs/prismic",
      "@nuxtjs/google-analytics",
      "@nuxtjs/sitemap",
      "nuxt-sm",
  ],

Which causes your page to break.

1 Like

Hi Phil,
I haven't yet managed to get the preview and the toolbar to work.
I will try again.
Thanks for your time and help.

Can you try in a different browser?

It works on Firefox now.
But not in Chrome and Safari.

It works for me in Chrome. Can you try changing your settings in Safari as described here? Then test again. Can you test locally too?

I find the solution, it was the same problem as Safari with cookies.

1 Like

I'm glad you figured it out :slight_smile: hopefully this thread will help others in the future.