-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
createPages uses stale cached data for "previous" and "next" pages #26520
Comments
I think I have this exact same issue. I used starter blog and I also used the instructions from the Gatsby site regarding adding pagination and I also found that when I added blog post 5, blog post 4 was not updated with the new next link. |
I was focused on the previous/next links when I submitted this issue, but looking at it now I realize that the much more critical bug is probably the fact that deleted markdown pages are not deleted from builds (when the cache is used). |
Same here. The data is not updated either. Opened an issue here #28281 |
Have someone found a solution for this? I see the last comment is from 18 Aug. This is a big issue in my opinion, because if I want it to work I must opt-out of caching between builds. For smaller websites is not a problem, but for large ones it is really bad. I am using Netlify CMS with Markdown files so my clients want to make changes to some pages and those changes are saved, but in reality, they are not present on the built pages... |
@vstoyanoff - I opened PR that is looking to solve this - #28351 - for now it's draft, because there are some additional considerations to make, but you can follow that PR for the potential fix for this problem. |
@pieh Thanks for the follow up! I will watch for solution in the meantime. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Are there any workarounds for this issue? Other than |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Any update on a fix or workaround to this issue? Would love to see this resolved - we had to stop using the Gatsby cache during builds to get around this issue, which obviously hurts build times significantly. |
seems like it is not needed for gatsby 3
seems like it is not needed for gatsby 3
Our project is experiencing the same problem. The sort order of items that are imported as nodes is not kept by, but differs each time one adds or edits items. Running "gatsby clean" and re-building solves that problem, of course. I tried to quick-fix this issue by generating a differing "contentDigest" on the target entities (e.g. adding random fake fields/contents). This did have no effect at all, however... |
Hey folks, fix will take a bit more time - in the meantime I can provide workaround for changing page context not invalidating query results - pieh/page-context-invalidation-workaround@5720ca3 - I tried to make it as generic as possible, but it's always possible it won't apply for every case.
@FlxAlbroscheit This is a bit different "issue" - when you don't use |
Hey @pieh thanks for your workaround approch, but i think this wont work for some cases. We're building on Netlify and have found our own workaround:
This way Gatsby will recognize a change in the config-file and delete its cache. But since we're using the netlify cache, we can at least persist all image data and therefor still build relatively fast. |
Description
I noticed this on my own blog's "previous post" and "next post" links, and it's reproducible on
gatsby-starter-blog
. It may have broader implications beyond my use case as well.If you have links to "previous" and "next" posts on each blog post's page, then those are not updated on each build. As you add posts, they remember their cached "previous" link, but are never updated with the "next." If a post is removed, then existing "previous/next" links are preserved. (And its page will still exist in the build.)
Steps to reproduce
I made a sample repo (almost identical to
gatsby-starter-blog
): https://github.com/johnridesabike/gatsby-prev-nextIf you serve the built site, everything should be normal. The next part is where the problem happens:
Expected result
The build should use up-to-date data in regards to "previous" and "next" links.
Actual result
If you open the new built site, the new post ("Test Post") should be present. The previous post ("New Beginnings") does not link to it. Clearing the cache fixes the problem:
The site should build as expected.
But now, if you remove the
content/blog/test-post
directory, and rungatsby build
, "Test Post" won't appear on the index page but the "New Beginnings" post will still link to it (and the "Test Post" page will still exist in the build.)Additional information
I played around a bit trying to figure out how to bust the stale data, but with no luck. One thing I noticed is that the
createPages
function uses this logic to generate theprevious
andnext
data:I tried to update it to use a GraphQL query instead:
This had no effect. The stale cache was still used.
If it's not feasible to make the caching "smart" enough for this scenario, it would be also good if
createPages
had the ability to manually use or override the cache, as well as delete cached pages after their source data has been deleted.Environment
The text was updated successfully, but these errors were encountered: