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 <noreply@anthropic.com>
This commit is contained in:
Jason Hoku
2026-11-04 03:29:06 -08:00
co-authored by Claude Fable 5.1
parent e65583fe04
commit d5e6e0662a
+10 -3
View File
@@ -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';