Skip to content

Commit

Permalink
Enable refresh when offline
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Jul 15, 2024
1 parent b6e0e48 commit 163496d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/healthchecksio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion src/sentry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 163496d

Please sign in to comment.