diff options
| author | soryu <soryu@soryu.co> | 2026-02-09 14:39:36 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-09 14:39:36 +0000 |
| commit | bfa7bd8d7609397f570f1cd9b83d2269abc0ed63 (patch) | |
| tree | 71e4e3decb5b07550427472079dfddffcc5c3753 /makima/frontend/src | |
| parent | a2646a828febbdac798a206655a15eae7e463bca (diff) | |
| download | soryu-bfa7bd8d7609397f570f1cd9b83d2269abc0ed63.tar.gz soryu-bfa7bd8d7609397f570f1cd9b83d2269abc0ed63.zip | |
Add directive task progression
Diffstat (limited to 'makima/frontend/src')
| -rw-r--r-- | makima/frontend/src/hooks/useDirectives.ts | 11 |
1 files changed, 11 insertions, 0 deletions
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); |
