From bfa7bd8d7609397f570f1cd9b83d2269abc0ed63 Mon Sep 17 00:00:00 2001 From: soryu Date: Mon, 9 Feb 2026 14:39:36 +0000 Subject: Add directive task progression --- makima/frontend/src/hooks/useDirectives.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'makima/frontend/src/hooks') diff --git a/makima/frontend/src/hooks/useDirectives.ts b/makima/frontend/src/hooks/useDirectives.ts index b69275a..f5f2b36 100644 --- a/makima/frontend/src/hooks/useDirectives.ts +++ b/makima/frontend/src/hooks/useDirectives.ts @@ -80,6 +80,17 @@ export function useDirective(id: string | undefined) { refresh(); }, [refresh]); + // Auto-poll while directive is active or has an orchestrator task + useEffect(() => { + if (!directive) return; + const needsPolling = + directive.status === "active" || directive.orchestratorTaskId != null; + if (!needsPolling) return; + + const interval = setInterval(refresh, 5000); + return () => clearInterval(interval); + }, [directive?.status, directive?.orchestratorTaskId, refresh]); + const update = useCallback(async (req: UpdateDirectiveRequest) => { if (!id) return; await updateDirective(id, req); -- cgit v1.2.3