prismicio / universal-react-website

MIT License
25 stars 8 forks source link

Not setting Preview Cookie breaks isomorphic/ preview #3

Open beesnotincluded opened 5 years ago

beesnotincluded commented 5 years ago

I was following along with the example in this project to set up an isomorphic/universal react project. I have found that the preview only works if i ignore commit fa59821cad2943d334075391cdbaa4eff98bddd0 and continue to set the Prismic.previewCookie. Without this, server-side rendering of the page being previewed will fail because there will be no previewSession token reference available which means prismic will either fetch the master ref version, or, if the preview item is not yet published, will fail to fetch anything.

I suspect that, the prismic toolbar manages setting cookie context, but of course this code won't be run on server side as it is loaded in the section and will only be executed by the browser.

This is the offending commit:

https://github.com/prismicio/universal-react-website/commit/fa59821cad2943d334075391cdbaa4eff98bddd0

levimykel commented 5 years ago

Hi @beesnotincluded, sorry for the delay on this. I will add this to our backlog and someone will look into it as soon as we are able. Thanks for bringing it to our attention.