After deploying my blog with Next.js, I noticed new posts weren’t showing up right away. Turns out, the page was fetching content at build time - not on each visit. Here’s what went wrong, what I changed, and why it matters.
Karoli Oduor
Software Developer
I encountered a subtle but annoying problem after deploying my site: the blog page wasn’t displaying new content. I’d add a post in my CMS or database, refresh the site, and nothing would appear.
At first, I thought the issue was with the backend or maybe caching. But the data was there - I could see it in Supabase. It just wasn’t showing up on the site.
Then I looked at my Next.js page setup and it clicked, I was using getStaticProps
. That means the blog content was being fetched at build time, not on every request. Therefore, unless I rebuilt the entire site, any new posts wouldn’t be visible. That’s great for performance, but terrible for a blog where freshness matters.
The Fix
I switched to getServerSideProps
. That change told Next.js to fetch the data on every page load, not just during the build.
export async function getServerSideProps() {
const { data: posts } = await supabase.from('posts').select('*').order('created_at', { ascending: false })
return {
props: {
posts,
},
}
}
Now, anytime a user visits the blog, they get the latest content. No rebuilds. No weird caching issues.
When to Use Server-Side Rendering (SSR). Switching from static generation to SSR is a tradeoff. Here’s why it made sense for me:
Dynamic content: New blog posts should be visible immediately
No admin rebuild flow: I didn’t want to set up revalidation or webhooks just to refresh the page
It’s still fast enough: My site isn’t high traffic, so server load isn't an issue
Takeaway:
If your page shows stale data, check whether you're using getStaticProps
or getServerSideProps
. Static generation is great, but only when your content doesn’t change often.
Subscribe to our newsletter for more insights and tutorials on software development.
Subscribe Now