From 9835b9f6d4c2f5a6c35eed18f448415d74af59ce Mon Sep 17 00:00:00 2001 From: James Pine Date: Sun, 15 Mar 2026 10:07:44 -0700 Subject: [PATCH] fix: prevent stale release data by removing Next.js fetch cache Replace next: { revalidate: 600 } with cache: 'no-store' on GitHub API fetches so new releases show up within 5 minutes (in-memory cache only, no Next.js/Vercel cache layer on top). --- landing/src/app/api/releases/route.ts | 1 - landing/src/lib/releases.ts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/landing/src/app/api/releases/route.ts b/landing/src/app/api/releases/route.ts index 60689465..cf10309d 100644 --- a/landing/src/app/api/releases/route.ts +++ b/landing/src/app/api/releases/route.ts @@ -2,7 +2,6 @@ import { NextResponse } from 'next/server'; import { getLatestRelease } from '@/lib/releases'; export const dynamic = 'force-dynamic'; -export const revalidate = 600; // Revalidate every 10 minutes export async function GET() { try { diff --git a/landing/src/lib/releases.ts b/landing/src/lib/releases.ts index b2847dfe..70baba36 100644 --- a/landing/src/lib/releases.ts +++ b/landing/src/lib/releases.ts @@ -18,7 +18,7 @@ const GITHUB_API_BASE = 'https://api.github.com'; // Cache for release info (in-memory cache, resets on server restart) let cachedReleaseInfo: ReleaseInfo | null = null; let cacheTimestamp: number = 0; -const CACHE_DURATION = 1000 * 60 * 10; // 10 minutes +const CACHE_DURATION = 1000 * 60 * 5; // 5 minutes // Cache for star count let cachedStarCount: number | null = null; @@ -36,7 +36,7 @@ export async function getLatestRelease(): Promise { try { const response = await fetch(`${GITHUB_API_BASE}/repos/${GITHUB_REPO}/releases/latest`, { - next: { revalidate: 600 }, // Revalidate every 10 minutes + cache: 'no-store', headers: { Accept: 'application/vnd.github.v3+json', }, @@ -123,6 +123,7 @@ async function getTotalDownloads(): Promise { const response = await fetch( `${GITHUB_API_BASE}/repos/${GITHUB_REPO}/releases?per_page=100&page=${page}`, { + cache: 'no-store', headers: { Accept: 'application/vnd.github.v3+json' }, }, );