Skip to content

Self-hosted AI workspace.

Python

fix(sessions): await DELETE before reloading sidebar session list (#1699)

Wes Huber7ee5248be346
diff --git a/static/js/sessions.js b/static/js/sessions.js
index c89206c98..26fa46a7b 100644
--- a/static/js/sessions.js
+++ b/static/js/sessions.js
@@ -678,10 +678,11 @@ function createSessionItem(s) {
} else {
_forceSidebarOpen();
}
- // Fire API and reload in background
- fetch(`${API_BASE}/api/session/${s.id}`, { method: 'DELETE' })
- .then(() => loadSessions())
- .catch(() => loadSessions());
+ // Await API deletion, then reload the authoritative list from the server
+ try {
+ await fetch(`${API_BASE}/api/session/${s.id}`, { method: 'DELETE' });
+ } catch (e) { /* network error — session may still exist server-side */ }
+ await loadSessions();
});
archiveItem.addEventListener('click', async () => {