MCPcopy
hub / github.com/AutoMaker-Org/automaker / confirmDeleteSession

Function confirmDeleteSession

apps/ui/src/components/session-manager.tsx:295–319  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

293
294 // Confirm delete session
295 const confirmDeleteSession = async (sessionId: string) => {
296 const api = getElectronAPI();
297 if (!api?.sessions) return;
298
299 const result = await api.sessions.delete(sessionId);
300 if (result.success) {
301 const refetchResult = await invalidateSessions();
302 if (currentSessionId === sessionId) {
303 // Switch to another session using fresh data, excluding the deleted session
304 // Filter to sessions within the same worktree to avoid jumping to a different worktree
305 const freshSessions = refetchResult?.data ?? [];
306 const activeSessionsList = freshSessions.filter((s) => {
307 if (s.isArchived || s.id === sessionId) return false;
308 const sessionDir = s.workingDirectory || s.projectPath;
309 return pathsEqual(sessionDir, effectiveWorkingDirectory);
310 });
311 if (activeSessionsList.length > 0) {
312 onSelectSession(activeSessionsList[0].id);
313 } else {
314 onSelectSession(null);
315 }
316 }
317 }
318 setSessionToDelete(null);
319 };
320
321 // Delete all archived sessions
322 const handleDeleteAllArchivedSessions = async () => {

Callers

nothing calls this directly

Calls 3

getElectronAPIFunction · 0.90
pathsEqualFunction · 0.90
deleteMethod · 0.45

Tested by

no test coverage detected