feat: LIVE/PAUSED toggle controls data fetching on sidebar navigation
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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user