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:
@@ -81,6 +81,12 @@ export default function OrderDetailPage() {
|
|||||||
const { data: order, isLoading } = useQuery({
|
const { data: order, isLoading } = useQuery({
|
||||||
queryKey: ['order', id],
|
queryKey: ['order', id],
|
||||||
queryFn: () => getOrder(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({
|
const submitMut = useMutation({
|
||||||
|
|||||||
Reference in New Issue
Block a user