Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/frontend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,17 +447,26 @@ function generateAllTitles() {

// ── Data loading ───────────────────────────────────────────────

var _loadSessionsInFlight = false;

async function loadSessions() {
if (_loadSessionsInFlight) return;
_loadSessionsInFlight = true;
try {
var resp = await fetch('/api/sessions');
allSessions = await resp.json();
// Invalidate analytics cache so stale aggregates are not shown
_analyticsHtmlCache = null;
_analyticsCacheUrl = null;
applyFilters();
// Progressive loading: if server is still loading cursor vscdb sessions, auto-refresh
if (resp.headers.get('X-Loading') === '1') {
setTimeout(loadSessions, 2000);
}
} catch (e) {
document.getElementById('content').innerHTML = '<div class="empty-state">Failed to load sessions. Is the server running?</div>';
} finally {
_loadSessionsInFlight = false;
}
}

Expand Down Expand Up @@ -1980,6 +1989,7 @@ function dismissUpdate() {
loadTerminals();
checkForUpdates();
setInterval(checkForUpdates, 10000); // check every 10s
setInterval(loadSessions, 60000); // refresh sessions + invalidate analytics cache every 60s
startActivePolling();

// Apply saved theme
Expand Down
Loading