Skip to content

Commit 99954e7

Browse files
grimmerkclaude
andcommitted
feat: show assistant responses for all sessions, not just active
Fixes #66 item 4 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 105c6b9 commit 99954e7

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

src/switcher-ui.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,14 @@ function SwitcherApp() {
382382
setAllSessions(newSessions);
383383
setSessions(sessionSearchValue.trim() ? filterSessionsLocally(newSessions, sessionSearchValue) : newSessions);
384384

385-
// Step 2: Detect active sessions in background (slow, spawns processes)
385+
// Step 2: Load last assistant responses for all sessions (first 100)
386+
window.electronAPI.loadLastAssistantResponses(result.slice(0, 100)).then((responses: Record<string, string>) => {
387+
if (responses && Object.keys(responses).length > 0) {
388+
setAssistantResponses((prev: Record<string, string>) => ({ ...prev, ...responses }));
389+
}
390+
});
391+
392+
// Step 3: Detect active sessions in background (slow, spawns processes)
386393
window.electronAPI.detectActiveSessions().then((activeMap: Record<string, number>) => {
387394
// Save to ref for SWR on next refresh
388395
activeStateRef.current = activeMap || {};
@@ -397,17 +404,6 @@ function SwitcherApp() {
397404

398405
if (activeMap && Object.keys(activeMap).length > 0) {
399406

400-
const activeSessions = (result || []).filter((s: any) => s.sessionId in activeMap);
401-
402-
// Step 2b: Load last assistant responses for active sessions only
403-
if (activeSessions.length > 0) {
404-
window.electronAPI.loadLastAssistantResponses(activeSessions).then((responses: Record<string, string>) => {
405-
if (responses && Object.keys(responses).length > 0) {
406-
setAssistantResponses((prev: Record<string, string>) => ({ ...prev, ...responses }));
407-
}
408-
});
409-
}
410-
411407
// Step 2c: Detect terminal apps for active sessions
412408
if (Object.keys(activeMap).length > 0) {
413409
window.electronAPI.detectTerminalApps(activeMap).then((apps: Record<string, string>) => {
@@ -1121,8 +1117,8 @@ function SwitcherApp() {
11211117
)}
11221118
</div>
11231119
)}
1124-
{/* Line 3: Last assistant response (only for active sessions) */}
1125-
{session.isActive && assistantResponses[session.sessionId] && (
1120+
{/* Line 3: Last assistant response */}
1121+
{assistantResponses[session.sessionId] && (
11261122
<div style={{ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', marginTop: '1px' }}>
11271123
<span style={{ color: '#9DC8E0', fontSize: '11px' }}>
11281124
<Highlighter

0 commit comments

Comments
 (0)