Files
homarr/packages/widgets/src/speedtest-tracker/index.ts
T
ajnart 7fe17c7384 fix(widgets): add refetchInterval to WidgetDefinition for per-widget polling
The v1.69.0 caching refactor replaced Redis pub/sub with a global 30s
client polling interval. Live monitoring widgets (health-monitoring,
Dashdot, dns-hole) that previously refreshed every 5s were stuck at 30s.

Adds refetchInterval?: number | null to WidgetDefinition:
- number = poll every N seconds (e.g. 5 for live monitoring)
- null = fetch on mount only, no background polling
- undefined = use global 30s default

9 widgets set refetchInterval: 5 (live monitoring)
16 widgets set refetchInterval: null (slow data, mount-only)
Removed inline refetchInterval from docker widget component.

Fixes #6268
2026-07-15 11:47:31 +02:00

40 lines
1.1 KiB
TypeScript

import { IconServerOff, IconSpeedboat } from "@tabler/icons-react";
import { createWidgetDefinition } from "../definition";
import { optionsBuilder } from "../options";
export const { definition, componentLoader } = createWidgetDefinition("speedtestTracker", {
icon: IconSpeedboat,
refetchInterval: null,
createOptions() {
return optionsBuilder.from(
(factory) => ({
showLatestResult: factory.switch({
defaultValue: true,
}),
showStats: factory.switch({
defaultValue: true,
}),
showRecentResults: factory.switch({
defaultValue: true,
}),
showPingGraph: factory.switch({
defaultValue: true,
}),
}),
{
showPingGraph: {
shouldHide: (options) => !options.showRecentResults,
},
},
);
},
supportedIntegrations: ["speedtestTracker"],
errors: {
INTERNAL_SERVER_ERROR: {
icon: IconServerOff,
message: (t) => t("widget.speedtestTracker.error.internalServerError"),
},
},
}).withDynamicImport(() => import("./component"));