From d5e6e0662a1d2edda41c49f68ac08fc5f0ec753b Mon Sep 17 00:00:00 2001 From: Jason Hoku Date: Wed, 4 Nov 2026 03:29:06 -0800 Subject: [PATCH] perf(dashboard): defer the session-list fetch until the first manifest fetch is done /config_tester/list_sessions scans every session folder on the server's event loop; fired in parallel at boot it held the (executor-compressed) manifest response back by ~200 ms. Co-Authored-By: Claude Fable 5.1 --- resources/logic_utils.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/logic_utils.js b/resources/logic_utils.js index 94ddf10..4016b6b 100644 --- a/resources/logic_utils.js +++ b/resources/logic_utils.js @@ -221,7 +221,12 @@ async function loadSession(prefetched, opts) { alert("Load Error: " + e.message); } } finally { - if (boot) window._uscgBootPending = false; + if (boot) { + const wasPending = window._uscgBootPending; + window._uscgBootPending = false; + // success path (the failure path already refreshed the landing page): populate the session picker now + if (wasPending && typeof fetchAndShowSessions === 'function') fetchAndShowSessions(); + } } } @@ -403,8 +408,10 @@ function showSessionLandingIfEmpty() { const landing = document.getElementById('session-landing'); const viewport = document.getElementById('viewport'); - // Always populate session picker dropdown and landing cards - fetchAndShowSessions(); + // Always populate session picker dropdown and landing cards. While the first manifest fetch is in + // flight the list waits (loadSession fetches it right after): /list_sessions scans every session + // folder on the server's event loop and would hold up the manifest response behind it. + if (!window._uscgBootPending) fetchAndShowSessions(); if (!hasData && landing && viewport) { landing.style.display = 'block';