From ce6813db99e39b4e79a76c999f28597c6062d740 Mon Sep 17 00:00:00 2001 From: keyhan Date: Tue, 16 Jun 2026 02:23:01 +0330 Subject: [PATCH] fix(logs): stop build-log polling once build finishes The build-logs tab kept polling every 5s and showing the auto-refresh indicator even after the build reached a terminal state. Gate both on the build still being in progress, and label a completed build as "done" instead of the misleading "running" status. Co-Authored-By: Claude Opus 4.8 --- frontend/src/components/workload-logs-panel.tsx | 16 +++++++++++++--- frontend/src/i18n/dictionaries/en.ts | 1 + frontend/src/i18n/dictionaries/fa.ts | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/workload-logs-panel.tsx b/frontend/src/components/workload-logs-panel.tsx index 225a37a..e72eb59 100644 --- a/frontend/src/components/workload-logs-panel.tsx +++ b/frontend/src/components/workload-logs-panel.tsx @@ -50,6 +50,11 @@ export function WorkloadLogsPanel({ refetchInterval: showLogs && logTab === 'pod' ? 3000 : false, }); + // Only keep polling while a build is still in progress; once it reaches a + // terminal state (running/failed/cancelled/…) the log is final, so stop. + const buildInProgress = (status?: string) => + !status || status === 'pending' || status === 'building' || status === 'deploying'; + const { data: buildLogsData } = useQuery<{ buildLog: string | null; status: string; @@ -58,9 +63,14 @@ export function WorkloadLogsPanel({ queryKey: ['build-logs', appId], queryFn: () => api.get(`/deployments/applications/${appId}/build-logs`).then((r) => r.data), enabled: showBuildLogs && showLogs && logTab === 'build', - refetchInterval: showBuildLogs && showLogs && logTab === 'build' ? 5000 : false, + refetchInterval: (query) => + showBuildLogs && showLogs && logTab === 'build' && buildInProgress(query.state.data?.status) + ? 5000 + : false, }); + const buildIsLive = showBuildLogs && showLogs && logTab === 'build' && buildInProgress(buildLogsData?.status); + const podPlaceholder = emptyPodMessage || (isRunning @@ -82,7 +92,7 @@ export function WorkloadLogsPanel({ {wl.liveEvery3s} )} - {showBuildLogs && showLogs && logTab === 'build' && ( + {buildIsLive && ( {wl.autoEvery5s} @@ -147,7 +157,7 @@ export function WorkloadLogsPanel({ {buildLogsData.version} - {statusLabel(buildLogsData.status)} + {buildLogsData.status === 'running' ? wl.buildDone : statusLabel(buildLogsData.status)} )} diff --git a/frontend/src/i18n/dictionaries/en.ts b/frontend/src/i18n/dictionaries/en.ts index bcd8702..e6dc96a 100644 --- a/frontend/src/i18n/dictionaries/en.ts +++ b/frontend/src/i18n/dictionaries/en.ts @@ -233,6 +233,7 @@ const en: Dictionary = { buildPending: 'Build is pending...', noDeployments: 'No deployments yet. Deploy your app to see build logs.', noBuildLogs: 'No build logs available for this deployment.', + buildDone: 'Done', }, externalAccess: { title: 'External access', diff --git a/frontend/src/i18n/dictionaries/fa.ts b/frontend/src/i18n/dictionaries/fa.ts index f01545a..39e94a2 100644 --- a/frontend/src/i18n/dictionaries/fa.ts +++ b/frontend/src/i18n/dictionaries/fa.ts @@ -232,6 +232,7 @@ const fa = { buildPending: 'بیلد در صف است…', noDeployments: 'هنوز دیپلویی نیست. برای دیدن لاگ بیلد اپت را منتشر کن.', noBuildLogs: 'لاگ بیلدی برای این دیپلوی موجود نیست.', + buildDone: 'انجام شده', }, externalAccess: { title: 'دسترسی خارجی',