From d322cc3ce14a330ed89e8715fa5ae6a89d92a712 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Mar 2026 08:57:01 +0000 Subject: [PATCH] Fix: log viewer wipes itself due to auto-reload on deploy done Two bugs causing 'can't see why deploy failed': - showLog() called window.location.reload() on the SSE 'done' event, wiping the log panel before the user could read it. - For already-finished deploys, SSE would immediately fire 'done' and reload, showing logs for < 1 second. Fix: - showLog() now fetches the deploy via REST first. If done, it renders the stored log directly (no SSE). If still running, it streams via SSE and closes without reloading when done. - Added onerror fallback: re-fetches the log via REST if SSE drops. - Status badge (green/red) updates inline instead of triggering reload. - Page now auto-opens the latest deploy log on load so the failure reason is visible immediately without any clicking. https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH --- server/src/routes/ui.rs | 75 +++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/server/src/routes/ui.rs b/server/src/routes/ui.rs index a6164f5..aa2d66d 100644 --- a/server/src/routes/ui.rs +++ b/server/src/routes/ui.rs @@ -213,6 +213,8 @@ pub async fn app_detail( .await .unwrap_or_default(); + let latest_deploy_id = deploys.first().map(|d| d.id.as_str()).unwrap_or(""); + let mut deploy_rows = String::new(); for d in &deploys { let sha_short = d.sha.as_deref() @@ -268,7 +270,7 @@ pub async fn app_detail( {deploy_rows} @@ -299,20 +301,64 @@ pub async fn app_detail( "#, - name = app.name, - repo = app.repo_url, - branch = app.branch, - port = app.port, - host = host, - app_id = app.id, - secret = app.webhook_secret, - deploy_rows = deploy_rows, - env_rows = env_rows, + name = app.name, + repo = app.repo_url, + branch = app.branch, + port = app.port, + host = host, + app_id = app.id, + secret = app.webhook_secret, + deploy_rows = deploy_rows, + env_rows = env_rows, + latest_deploy_id = latest_deploy_id, ); Ok(Html(page(&app.name, &body)))