From 163496dfd11476e20bfa2039ac94f092c07b0574 Mon Sep 17 00:00:00 2001 From: Ben Zhang Date: Mon, 15 Jul 2024 22:10:31 +0000 Subject: [PATCH] Enable refresh when offline --- src/healthchecksio.tsx | 2 +- src/sentry.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/healthchecksio.tsx b/src/healthchecksio.tsx index 0e365f1..e4aaac2 100644 --- a/src/healthchecksio.tsx +++ b/src/healthchecksio.tsx @@ -78,7 +78,7 @@ function shortenCheckName(groupKey: typeof GROUP_KEYS[number], groupName: string export function HealthchecksioStatus({ showInternal, initialGroupKey = "" }: { showInternal?: boolean, initialGroupKey?: string }) { const [groupKey, setGroupKey] = useState((GROUP_KEYS.includes(initialGroupKey as any) ? initialGroupKey : GROUP_KEYS[0]) as typeof GROUP_KEYS[number]); - const { data: dataRaw, error, isLoading } = useSWR('/api/v3/checks/', healthchecksioFetcher, { refreshInterval: 5000 }); + const { data: dataRaw, error, isLoading } = useSWR('/api/v3/checks/', healthchecksioFetcher, { refreshInterval: 500, refreshWhenOffline: true }); const checks = (processHCData(dataRaw) || []).filter(check => check.tags_dict.public !== 'False' || showInternal).sort((a, b) => a.name.localeCompare(b.name)); const groupedChecks = groupBy(checks, c => c.tags_dict[groupKey]); diff --git a/src/sentry.tsx b/src/sentry.tsx index b80ba4a..aca0b9f 100644 --- a/src/sentry.tsx +++ b/src/sentry.tsx @@ -18,7 +18,7 @@ function getStatusSymbol(status: SentryStatus) { } export function SentryStatus() { - const { data: monitors, error, isLoading } = useSWR('/api/0/organizations/watonomous/monitors/', sentryFetcher, { refreshInterval: 5000 }); + const { data: monitors, error, isLoading } = useSWR('/api/0/organizations/watonomous/monitors/', sentryFetcher, { refreshInterval: 5000, refreshWhenOffline: true }); // process data if (monitors) {