From 8864df2b2cb7097e267a854937bfb1066adaad14 Mon Sep 17 00:00:00 2001 From: Aaron Date: Sat, 13 Dec 2025 12:07:02 -0500 Subject: [PATCH] Keep last good status on fetch failure; retry and log to diagnostics --- pikit-web/assets/main.js | 10 ++++++++-- pikit-web/index.html | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pikit-web/assets/main.js b/pikit-web/assets/main.js index 0db256d..d4659e2 100644 --- a/pikit-web/assets/main.js +++ b/pikit-web/assets/main.js @@ -6,7 +6,7 @@ import { initServiceControls, renderServices } from "./services.js"; import { initSettings } from "./settings.js"; import { initUpdateSettings, isUpdatesDirty } from "./update-settings.js"; import { initReleaseUI } from "./releases.js?v=20251213h"; -import { initDiagUI, logUi } from "./diaglog.js?v=20251213i"; +import { initDiagUI, logUi } from "./diaglog.js?v=20251213j"; const servicesGrid = document.getElementById("servicesGrid"); const heroStats = document.getElementById("heroStats"); @@ -133,6 +133,7 @@ let toastDurationMs = 5000; let toastSpeedMs = 300; let fontChoice = "redhat"; let releaseUI = null; +let lastStatusData = null; function applyToastSettings() { if (!toastContainer) return; @@ -318,6 +319,7 @@ function setUpdatesUI(enabled) { async function loadStatus() { try { const data = await getStatus(); + lastStatusData = data; renderStats(heroStats, data); renderServices(servicesGrid, data.services, { openAddService }); const updatesEnabled = @@ -358,7 +360,11 @@ async function loadStatus() { releaseUI?.refreshStatus(); } catch (e) { console.error(e); - renderStats(heroStats, placeholderStatus); + logUi(`Status refresh failed: ${e?.message || e}`, "error"); + if (!lastStatusData) { + renderStats(heroStats, placeholderStatus); + } + setTimeout(loadStatus, 2000); } } diff --git a/pikit-web/index.html b/pikit-web/index.html index b396705..507cbe4 100644 --- a/pikit-web/index.html +++ b/pikit-web/index.html @@ -777,7 +777,7 @@ - +