From 75d204e7f39e1f59a2080d448afba573d2bbc78a Mon Sep 17 00:00:00 2001 From: alpha nerd Date: Sun, 7 Jun 2026 09:29:06 +0200 Subject: [PATCH] feat: use SSE reconnect to prevent API Key modal to pop up in dashboard if no API Key is configured --- static/index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/static/index.html b/static/index.html index 8c0b16c..d3a1069 100644 --- a/static/index.html +++ b/static/index.html @@ -1171,11 +1171,13 @@ function renderTimeSeriesChart(timeSeriesData, chart, minutes) { } }; - source.onerror = async (err) => { - console.error("SSE connection error. Retrying...", err); - source.close(); - await showApiKeyModal("Enter the NOMYO Router API key to view live usage."); - loadUsage(); + source.onerror = (err) => { + // EventSource auto-reconnects on transient drops as long as we + // don't close it. Don't treat a dropped stream as an auth failure: + // auth prompting is handled by loadEndpoints()/authedFetch() on the + // REST endpoints. A genuine 401 closes the stream permanently here + // (no reconnect loop), and the REST path surfaces the modal. + console.error("SSE connection error; awaiting auto-reconnect.", err); }; window.addEventListener("beforeunload", () => source.close()); }