fix(widgets): restore per-widget refetch intervals lost in v1.69.0 refactor

The v1.69.0 caching refactor (f19033e0d) replaced the old Redis pub/sub
push mechanism with a global 30s client-side polling interval. This
caused widgets that previously refreshed every 5s (e.g. health-monitoring,
Dashdot, dns-hole) to only refresh every 30s.

Adds a widgetRefetchIntervalOverrides map in query-cache.ts that maps
tRPC path prefixes to refetch intervals matching the pre-v1.69.0
server-side cacheDuration values. The TRPC provider applies these
overrides via setQueryDefaults after the global default.

Also restores server-side cacheTtlMs on all request handlers to prevent
duplicate upstream API calls between client polls, and adds cacheTtlMs
support to createWidgetRequestHandler.

Beszel handlers are left untouched as they have their own cache handling.

Fixes #6268
This commit is contained in:
ajnart committed 2026-07-15 10:59:38 +02:00
1 parent a0034b2cfc
commit a0fb7553a5
36 files changed
+89 -1

No files matched your search

@@ -2,6 +2,7 @@ import { createRequestHandler } from "./request-handler";
interface Options<TData, TInput extends Record<string, unknown>> {
requestAsync: (input: TInput) => Promise<TData>;
cacheTtlMs?: number;
}
export const createWidgetRequestHandler = <TData, TInput extends Record<string, unknown>>(
@@ -10,5 +11,6 @@ export const createWidgetRequestHandler = <TData, TInput extends Record<string,
handler: (widgetOptions: TInput) =>
createRequestHandler<TData, TInput>({
requestAsync: options.requestAsync,
cacheTtlMs: options.cacheTtlMs,
}).handler(widgetOptions),
});