
How I Fixed the Hashnode GraphQL API Stale Cache Bug (Stellate CDN)
If you're using Hashnode's GraphQL API to fetch your blog posts for a custom frontend (like a React or Next.js portfolio), you've probably run into this incredibly frustrating issue: You publish a new post on Hashnode, but it doesn't show up on your website. You check the API payload, and it's serving a stale list of posts. The new post is completely missing. I spent hours debugging this, trying every cache-busting trick in the book. Here's what didn't work, why it failed, and the actual simple solution. The Setup My portfolio runs on React (Vite) and uses Hashnode as a headless CMS. I fetch posts using fetch with the official Hashnode GraphQL endpoint: https://gql.hashnode.com . const res = await fetch ( ' https://gql.hashnode.com ' , { method : ' POST ' , headers : { ' Content-Type ' : ' application/json ' }, body : JSON . stringify ({ query : POSTS_QUERY , variables }), }); When I added a new post, my local dev server still only showed the old posts. The Failed Attempts Hashnode use
Continue reading on Dev.to Webdev
Opens in a new tab




