feat: refresh update status on every dev reload

This commit is contained in:
Linus Rath
2026-05-02 13:23:58 +02:00
parent bc97a1ac10
commit 5e096240b3
2 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
1.6.0
1.6.0
+13 -4
View File
@@ -1,11 +1,20 @@
import { NextResponse } from 'next/server';
import { loadState } from '@/lib/version-check';
import { checkOnce, loadState } from '@/lib/version-check';
// Public endpoint that returns the latest cached update status. Fed by the
// background scheduler started in instrumentation.node.ts; we never trigger
// a fresh upstream fetch from this route, so an unauthenticated client cannot
// use it to amplify traffic to the version server.
// background scheduler started in instrumentation.node.ts; in production we
// never trigger a fresh upstream fetch from this route so an unauthenticated
// client can't use it to amplify traffic to the version server.
//
// In development we force a fresh fetch on every hit so changes to the
// version server's overrides take effect on the next page reload instead of
// requiring a dev-server restart. The 5s upstream timeout in fetchStatus
// caps the worst-case latency added to a dev reload.
export async function GET() {
if (process.env.NODE_ENV === 'development') {
await checkOnce({ reason: 'dev-reload' });
}
const state = await loadState();
return NextResponse.json(
{