Skip to content

Commit 1041e34

Browse files
fix(uptime): Recompute uptime timeWindowConfig on interval (#101193)
Just refetching the monitor stats won't work, since we compute the stats from the time the timeWindowConfig was instantiated.
1 parent 0d753db commit 1041e34

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

static/app/views/alerts/rules/uptime/detailsTimeline.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,16 @@ export function DetailsTimeline({uptimeDetector, onStatsLoaded}: Props) {
2929
const {width: containerWidth} = useDimensions<HTMLDivElement>({elementRef});
3030
const timelineWidth = useDebouncedValue(containerWidth, 500);
3131

32-
const timeWindowConfig = useTimeWindowConfig({timelineWidth});
32+
const timeWindowConfig = useTimeWindowConfig({
33+
timelineWidth,
34+
recomputeInterval: 60_000,
35+
recomputeOnWindowFocus: true,
36+
});
3337

34-
const {data: uptimeStats} = useUptimeMonitorStats(
35-
{
36-
detectorIds: [String(uptimeDetector.id)],
37-
timeWindowConfig,
38-
},
39-
{
40-
refetchOnWindowFocus: true,
41-
refetchInterval: 60_000,
42-
}
43-
);
38+
const {data: uptimeStats} = useUptimeMonitorStats({
39+
detectorIds: [String(uptimeDetector.id)],
40+
timeWindowConfig,
41+
});
4442

4543
useEffect(
4644
() => uptimeStats?.[id] && onStatsLoaded?.(uptimeStats[id]),

0 commit comments

Comments
 (0)