fix(beszel): leverage TanStack Query for stale-while-revalidate caching (#6055)

This commit is contained in:
Thomas authored and GitHub committed 2026-06-22 17:17:09 +02:00
1 parent ea9dd716f0
commit bbc4589c9e
6 files changed
+24 -24

No files matched your search

@@ -67,7 +67,10 @@ export default function BeszelSystemStatsWidget({
data: systemsResult = [],
isPending: systemsPending,
error: systemsError,
} = clientApi.widget.beszel.getSystems.useQuery({ integrationIds }, { staleTime: 30 * 1000, retry: false });
} = clientApi.widget.beszel.getSystems.useQuery(
{ integrationIds },
{ staleTime: 10_000, gcTime: 48 * 60 * 60 * 1000, retry: false },
);
const systems = useMemo(
() => systemsResult.flatMap((r) => r.systems.map((s) => ({ value: s.id, label: s.name }))),
@@ -100,8 +103,9 @@ export default function BeszelSystemStatsWidget({
includeDocker: showDocker,
},
{
staleTime: 30 * 1000,
refetchInterval: isLive ? false : 5_000,
staleTime: 10_000,
gcTime: 48 * 60 * 60 * 1000,
refetchInterval: isLive ? false : 10_000,
enabled: !isLive && systemReady && selectedSystem !== "",
retry: false,
},