datocms / plugins

Repository providing samples using the Plugins SDK
MIT License
33 stars 47 forks source link

[Web Previews]: "Live" preview when saving/publishing doesn't work #103

Open vanska opened 8 months ago

vanska commented 8 months ago

The Web Previews plugin documentations contains an example (cover video) where the preview instantly updates on save/publish but it doesn't seem to work and the editor needs to press the refresh icon after saving/publishing. Is this something the plugin should provide (e.g. reload the preview on save/publish) or do I need to somehow implement it myself?

marcelofinamorvieira commented 8 months ago

Hello @vanska

To have live updates you need to use the Real Time Updates API https://www.datocms.com/docs/real-time-updates-api That will update the page automatically upon an update in Dato.

If you'd like to see an example of the implementation of this API you can check this Demo right here: https://github.com/datocms/next-landing-page-demo/tree/main deployable here https://www.datocms.com/marketplace/starters/marketing-website

More specifically, you can see how we use the Real Time Updates API right here, for the draft pages: https://github.com/datocms/next-landing-page-demo/blob/64766f4e3787c688f7b5f6264c64e1910c85050b/components/Blog/RealTime/RealTimePost.tsx#L8