feat: add auto-refresh toggle wired to all polling queries
Some checks failed
CI / build (push) Failing after 51s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Has been skipped
CI / deploy (push) Has been skipped
CI / deploy-feature (push) Has been skipped

Upgrade @cameleer/design-system to ^0.1.3 which adds LIVE/PAUSED
toggle to TopBar backed by autoRefresh state in GlobalFilterProvider.

Add useRefreshInterval() hook that returns the polling interval when
auto-refresh is on, or false when paused. Wire it into all query
hooks that use refetchInterval (executions, catalog, agents, metrics,
admin database/opensearch).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-24 18:10:32 +01:00
parent 6fea5f2c5b
commit 4ac11551c9
10 changed files with 81 additions and 47 deletions

View File

@@ -1,8 +1,10 @@
import { useQuery } from '@tanstack/react-query';
import { config } from '../../config';
import { useAuthStore } from '../../auth/auth-store';
import { useRefreshInterval } from './use-refresh-interval';
export function useRouteCatalog() {
const refetchInterval = useRefreshInterval(15_000);
return useQuery({
queryKey: ['routes', 'catalog'],
queryFn: async () => {
@@ -16,11 +18,12 @@ export function useRouteCatalog() {
if (!res.ok) throw new Error('Failed to load route catalog');
return res.json();
},
refetchInterval: 15_000,
refetchInterval,
});
}
export function useRouteMetrics(from?: string, to?: string, appId?: string) {
const refetchInterval = useRefreshInterval(30_000);
return useQuery({
queryKey: ['routes', 'metrics', from, to, appId],
queryFn: async () => {
@@ -38,6 +41,6 @@ export function useRouteMetrics(from?: string, to?: string, appId?: string) {
if (!res.ok) throw new Error('Failed to load route metrics');
return res.json();
},
refetchInterval: 30_000,
refetchInterval,
});
}