Title: Hashnode GraphQL returns stale posts due to Edge caching (latest published posts not visible immediately) · Issue #86 · Hashnode/support · GitHub
Open Graph Title: Hashnode GraphQL returns stale posts due to Edge caching (latest published posts not visible immediately) · Issue #86 · Hashnode/support
X Title: Hashnode GraphQL returns stale posts due to Edge caching (latest published posts not visible immediately) · Issue #86 · Hashnode/support
Description: Summary We are fetching posts from Hashnode GraphQL API (https://gql.hashnode.com/) for our website blog page. Even after publishing a new post, the API sometimes returns stale data (old totalDocuments and missing latest post). This look...
Open Graph Description: Summary We are fetching posts from Hashnode GraphQL API (https://gql.hashnode.com/) for our website blog page. Even after publishing a new post, the API sometimes returns stale data (old totalDocum...
X Description: Summary We are fetching posts from Hashnode GraphQL API (https://gql.hashnode.com/) for our website blog page. Even after publishing a new post, the API sometimes returns stale data (old totalDocum...
Opengraph URL: https://github.com/Hashnode/support/issues/86
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Hashnode GraphQL returns stale posts due to Edge caching (latest published posts not visible immediately)","articleBody":"**Summary**\n\nWe are fetching posts from Hashnode GraphQL API (https://gql.hashnode.com/) for our website blog page.\nEven after publishing a new post, the API sometimes returns stale data (old totalDocuments and missing latest post).\nThis looks like an Edge cache issue, where the response is served from cache even though the publication has new content.\n\n**What we expect**\n\nWhen a new blog post is published on our Hashnode publication, the query should return the latest post immediately (or within a predictable short time).\n\nWhat actually happens\n\t•\tAfter publishing a new post, our website still shows old posts\n\t•\ttotalDocuments stays the same (example: sometimes 46 instead of 47)\n\t•\tThe newest post doesn’t appear in posts.edges even when requesting the first page\n\t•\tSometimes after multiple requests or after some time, it starts showing the latest data\n\nSo the response is inconsistent even for the same query + variables.\n\nquery \n```graphql\nquery Publication($after: String, $first: Int!) {\n publication(host: \"prathamd01.hashnode.dev\") {\n posts(first: $first, after: $after) {\n totalDocuments\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n id\n slug\n title\n publishedAt\n url\n }\n }\n }\n }\n}\n```\n\n**Why we think this is Edge caching**\n\nHashnode docs mention that responses are cached at the Edge:\n\n“Almost all responses of queries are cached on the Edge.”\n“Cached data will automatically be purged if you mutate the data.”\n“If you don’t request the field id… it is possible that you get stale data.”\n\nWe are already requesting id fields, but still getting stale results.\n\n**What we tried**\n\n- Setting cache: \"no-store\" / cache: \"no-cache\" in fetch\n\n- Setting response headers in our Next.js API route:\n\n```graphql\nres.setHeader(\"Cache-Control\", \"no-store, max-age=0, must-revalidate\");\nres.setHeader(\"Pragma\", \"no-cache\");\n```\n\n- Still stale data sometimes.\n\n- Fetching more posts (first: 20) and sorting by publishedAt client-side\n\n- This works more often but feels like a workaround, not a real fix.\n\n✅ Polling every 15 seconds\n\n- Works but increases request count and is not ideal for production.\n\n\n**Key problem**\n\nEven if we bypass caching on our side, Hashnode still sometimes returns cached/stale data from the Edge, so the newest published post is not visible immediately.\n\n\n**Request / Question**\n\nIs there a way to ensure fresh posts data always comes from Hashnode GraphQL?\n\nFor example:\n\t•\tan option to disable edge caching for specific queries\n\t•\ta recommended approach for “latest posts” use-case\n\t•\ta way to force cache purge on publish/update\n\t•\tor a documented cache TTL / propagation time","author":{"url":"https://github.com/prathamd123","@type":"Person","name":"prathamd123"},"datePublished":"2026-01-16T05:04:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/86/support/issues/86"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2ac67e5c-60ad-016e-5173-14218486ef0e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAB2:14965D:590D454:7934E1D:697328B7 |
| html-safe-nonce | 01ead483a93fde1ec19d549719748000437db7727c3aa1ff37a27d33c6ae8c1c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUIyOjE0OTY1RDo1OTBENDU0Ojc5MzRFMUQ6Njk3MzI4QjciLCJ2aXNpdG9yX2lkIjoiNjU2MzQ0NzQ5NzQxNjcxNDQyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4f4a54899410df003c5491528c82e36f8b7ab654dff1d8262330d4d1c46b4e58 |
| hovercard-subject-tag | issue:3820365231 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Hashnode/support/86/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f10b9491354bc8a277ebed4e85f64973fae2a74c860850331b75613cca734e75/Hashnode/support/issues/86 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f10b9491354bc8a277ebed4e85f64973fae2a74c860850331b75613cca734e75/Hashnode/support/issues/86 |
| og:image:alt | Summary We are fetching posts from Hashnode GraphQL API (https://gql.hashnode.com/) for our website blog page. Even after publishing a new post, the API sometimes returns stale data (old totalDocum... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | prathamd123 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/Hashnode/support git https://github.com/Hashnode/support.git |
| octolytics-dimension-user_id | 16342708 |
| octolytics-dimension-user_login | Hashnode |
| octolytics-dimension-repository_id | 330598092 |
| octolytics-dimension-repository_nwo | Hashnode/support |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 330598092 |
| octolytics-dimension-repository_network_root_nwo | Hashnode/support |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width