feat: LIVE/PAUSED toggle controls data fetching on sidebar navigation
All checks were successful
CI / build (push) Successful in 1m13s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Successful in 55s
CI / deploy (push) Successful in 39s
CI / deploy-feature (push) Has been skipped

LIVE: sidebar clicks trigger initial fetch + polling for the new route.
PAUSED: sidebar clicks navigate but queries are disabled — no fetches
until the user switches back to LIVE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-25 10:01:14 +01:00
parent 9866dd5f23
commit 996ea65293
2 changed files with 23 additions and 9 deletions

View File

@@ -8,3 +8,16 @@ export function useRefreshInterval(intervalMs: number): number | false {
const { autoRefresh } = useGlobalFilters();
return autoRefresh ? intervalMs : false;
}
/**
* Returns `enabled` and `refetchInterval` tied to the LIVE/PAUSED toggle.
* - LIVE: enabled=true, refetchInterval=intervalMs (fetch + poll)
* - PAUSED: enabled=false, refetchInterval=false (no fetch at all)
*/
export function useLiveQuery(intervalMs: number) {
const { autoRefresh } = useGlobalFilters();
return {
enabled: autoRefresh,
refetchInterval: autoRefresh ? intervalMs : false as number | false,
};
}