fix(global-filter): keep time range sliding when auto-refresh is paused
All checks were successful
Build & Publish / publish (push) Successful in 1m6s
All checks were successful
Build & Publish / publish (push) Successful in 1m6s
The preset time window now advances on a 10s interval regardless of auto-refresh state. Pausing only stops query polling — the window stays current so manual refreshes see up-to-date data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,15 +66,17 @@ export function GlobalFilterProvider({ children }: { children: ReactNode }) {
|
|||||||
try { localStorage.setItem('cameleer:auto-refresh', String(enabled)) } catch {}
|
try { localStorage.setItem('cameleer:auto-refresh', String(enabled)) } catch {}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// Keep the time range sliding forward when a preset is active and live
|
// Keep the time range sliding forward whenever a preset is active.
|
||||||
|
// PAUSED mode only stops query polling — the time window still advances
|
||||||
|
// so that manual refreshes and sidebar-triggered queries see current data.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!autoRefresh || !timeRange.preset) return
|
if (!timeRange.preset) return
|
||||||
const id = setInterval(() => {
|
const id = setInterval(() => {
|
||||||
const { start, end } = computePresetRange(timeRange.preset!)
|
const { start, end } = computePresetRange(timeRange.preset!)
|
||||||
setTimeRangeState({ start, end, preset: timeRange.preset })
|
setTimeRangeState({ start, end, preset: timeRange.preset })
|
||||||
}, 10_000)
|
}, 10_000)
|
||||||
return () => clearInterval(id)
|
return () => clearInterval(id)
|
||||||
}, [autoRefresh, timeRange.preset])
|
}, [timeRange.preset])
|
||||||
|
|
||||||
const isInTimeRange = useCallback(
|
const isInTimeRange = useCallback(
|
||||||
(timestamp: Date) => {
|
(timestamp: Date) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user