Skip to content

Commit cafe9ff

Browse files
committed
docs(pty): note why AgentTerminalView needs no session key
Document that SessionChatInner is keyed by session.id (so the subtree remounts on session switch) and AgentTerminalView disconnects its socket on unmount — so the agent terminal never stays subscribed to a previous session's room. Pre-empts the recurring review misread that flags a stale subscription here.
1 parent fdedbcb commit cafe9ff

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

web/src/components/SessionChat.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,12 @@ function SessionChatInner(props: SessionChatProps) {
12011201
<DragDropZone disabled={sessionInactive || props.isSending || pendingSchedule != null}>
12021202
<div className="relative flex min-h-0 flex-1 flex-col">
12031203
{canViewAgentTerminal && (
1204+
// No `key` needed here: SessionChatInner is itself keyed by
1205+
// session.id (see SessionChat wrapper), so switching sessions
1206+
// fully remounts this subtree. AgentTerminalView's mount effect
1207+
// disconnects the agent-terminal socket on unmount, so the new
1208+
// session reconnects/subscribes fresh — the old room is never
1209+
// left subscribed.
12041210
<AgentTerminalView
12051211
sessionId={props.session.id}
12061212
visible={terminalVisible}

0 commit comments

Comments
 (0)