Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-source-prismic] Need to kill and restart gatsby develop server to see new published content #2271

Closed
mikedotJS opened this issue Sep 29, 2017 · 10 comments
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@mikedotJS
Copy link

Hey,

We're using Gatsby with Prismic.io and the gatsby-source-prismic plugin as backend. What we need would be Gatsby to watch new content from Prismic.io without having to kill the server and restart every time new content is published.

We use the createPages API to create new route each time something's new on Prismic.

Is this possible ?

@sebastienfi
Copy link
Contributor

Hi @mikedotJS At the moment Gatsby need to rebuild to incorporate new content. How would you do that in Gatsby API ?

@sebastienfi sebastienfi added API/Plugins type: bug An issue or pull request relating to a bug in Gatsby labels Oct 1, 2017
@sebastienfi sebastienfi changed the title Need to kill and restart gatsby develop server to see new published content [gatsby-source-prismic] Need to kill and restart gatsby develop server to see new published content Oct 1, 2017
@sebastienfi sebastienfi added performance type: question or discussion Issue discussing or asking a question about Gatsby and removed type: bug An issue or pull request relating to a bug in Gatsby labels Oct 1, 2017
@KyleAMathews
Copy link
Contributor

KyleAMathews commented Oct 1, 2017

@mikedotJS this is very possible! It's not a pattern that's been explored thoroughly in source plugins but the source plugin API is designed to allow for this use case.

An source plugin that does this is gatsby-source-filesystem. It watches for new files to be added to the filesystem and creates new nodes whenever it see a new file (or updates an existing one).

The prismic plugin could be altered to do this as well e.g. periodically check the Prismic API if there's been new content added. If Prismic has a way to auto-register a webhook, that'd be even better.

Also another idea I've had is that we could expose a way to re-run source plugins while the development server is running. So if you know someone added content to Prismic, you could go to the CLI where the development server is running and trigger checking for new source data.

@KyleAMathews
Copy link
Contributor

Also createPages already is run whenever new nodes are added so nothing new would need done there.

@aulneau
Copy link

aulneau commented Oct 16, 2017

@KyleAMathews prismic does indeed have a webhook for that -> here.

@KyleAMathews
Copy link
Contributor

@aulneau that's for setting up production builds. @mikedotJS is asking about auto-pulling content during development. Prismic's webhook wouldn't work for this as we'd want something that could be setup only for a finite-length development session through their node.js library.

@waltercolindres
Copy link

I'd love to see a solution to this. Would this be useful in any way?
https://www.npmjs.com/package/prismic-static

@tlvenn
Copy link

tlvenn commented Oct 22, 2017

Has anyone tried to spin a dev server to implement prismic preview feature ? It seems it would need to be able to discover new content on refresh as well.

https://prismic.io/blog/improvement-live-preview-in-website

@tlvenn
Copy link

tlvenn commented Oct 23, 2017

Kinda aiming for this kind of workflow:

which I think would be a pretty amazing recipe with Gatsby

https://futurice.com/blog/cms-done-right-vol-3

@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

@jonybekov
Copy link

So has this problem solved yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

8 participants