From 5e096240b3adf12a0831fc12755c4f44eefc8c29 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 2 May 2026 13:23:58 +0200 Subject: [PATCH] feat: refresh update status on every dev reload --- VERSION | 2 +- app/api/system/update-status/route.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index dc1e644a..ce6a70b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.6.0 +1.6.0 \ No newline at end of file diff --git a/app/api/system/update-status/route.ts b/app/api/system/update-status/route.ts index d3af2131..fd25da80 100644 --- a/app/api/system/update-status/route.ts +++ b/app/api/system/update-status/route.ts @@ -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( {