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

Deleted Contentful post still present in local build #28

Closed
robdcal opened this issue Aug 20, 2018 · 6 comments
Closed

Deleted Contentful post still present in local build #28

robdcal opened this issue Aug 20, 2018 · 6 comments

Comments

@robdcal
Copy link

robdcal commented Aug 20, 2018

First of all, fantastic job at putting this together Ryan. I'm new to pretty much everything involved here (React, Gatsby, Contenful, Netlify) but this project has helped me understand each of them.

I'm experiencing an issue where I've deleted one of the pre-existing posts ("Sailing Around The Bay") and it still shows in my local build. The live site is updated fine through Netlify.

I've run gatsby develop and gatsby build multiple times to try and 'flush' the change, but it remains.

To confirm, a graphQL query for posts on my local build brings back the following:

{ "data": { "allContentfulPost": { "edges": [ { "node": { "title": "Beach Day", "id": "c46W6F2LB9KK48AoKWGKQWy" } }, { "node": { "title": "A Walk In The Park", "id": "gaDq907enKa8UeKuAWOQG" } }, { "node": { "title": "Sailing Around The Bay", "id": "c2H1mrgshZeQki8UQ2yGq0s" } }, { "node": { "title": "Puppies!", "id": "c3wnBmHFsMg8KAOq2kagiks" } }, { "node": { "title": "Test Post", "id": "c3exNfAvwYg4IKK426sQS4S" } } ] } } }

If I run gatsby build then a public/sailing-around-the-bay folder is created with an index.html inside. As expected, if I open the local build then the home page displays the deleted blog post.

If I run gatsby develop then the folder remains but the index.html disappears. If I open the development site on the localhost URL then the home page still displays the deleted blog post.

Any ideas?

@brandonkal
Copy link
Contributor

Have you tried deleting the cache folder?

@robdcal
Copy link
Author

robdcal commented Aug 20, 2018

Thanks @brandonkal - that seems to have done the trick!

I actually saw that as a potential fix for a similar issue on another project / rep, but a lot of people said it didn't work so I didn't bother trying it. That'll teach me...

Any idea why this may have happened? Any thoughts on how to prevent this from happening?

Wondering whether the cache can be deleted every time as part of the build process (or does this defeat the point of it in the first place?)...

@brandonkal
Copy link
Contributor

The cache is useful for preventing unnecessary API calls to Contentful as usually changing posts or just adding more posts if more common. If you do delete content that has been built, deleting the cache is a nice way to avoid these problems.

@robdcal
Copy link
Author

robdcal commented Aug 20, 2018

OK thanks.

You've provided a solution, but I guess the root cause of the issue still exists. In this instance, would you close this issue on GitHub or leave it open for further investigation?

@brandonkal
Copy link
Contributor

I would close the issue here as it is not related to the GCN starter project. This issue is related to the gatsby-source-contentful package not invalidating the cache when content is deleted. This package is maintained by gatsby.

It looks like there is already an issue open for this, and you can add to the discussion here: gatsbyjs/gatsby#3495

@robdcal
Copy link
Author

robdcal commented Aug 20, 2018

Many thanks for the information and tips.

10/10 would GitHub again.

@robdcal robdcal closed this as completed Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants