fix: auto-poll order detail while renders are active (3s interval)

Added refetchInterval to the order query that polls every 3 seconds
while render_progress has pending or processing lines. Stops polling
automatically when all renders reach a terminal state (completed/failed/cancelled).

Fixes: render log and backend status not appearing until manual page reload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 09:40:49 +01:00
parent 2c7eb81aab
commit db9f6f45ed
+6
View File
@@ -81,6 +81,12 @@ export default function OrderDetailPage() {
const { data: order, isLoading } = useQuery({
queryKey: ['order', id],
queryFn: () => getOrder(id!),
// Poll while renders are active (pending/processing) — stop when all terminal
refetchInterval: (query) => {
const rp = query.state.data?.render_progress
if (!rp) return false
return (rp.pending > 0 || rp.processing > 0) ? 3000 : false
},
})
const submitMut = useMutation({