Skip to content

Commit 714b490

Browse files
committed
fix(web): reset per-thread view state on scoped thread key
Cloned state can repeat a bare thread id across environments; the scroll, checkpoint-revert, env-mode, and composer-refocus resets keyed on the bare id would skip when navigating between two such threads. Finding by gpt-5.6-sol; fix by Claude Fable 5 in Claude Code.
1 parent a80a322 commit 714b490

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4339,11 +4339,13 @@ function ChatViewContent(props: ChatViewProps) {
43394339
showScrollDebouncer.current.cancel();
43404340
setShowScrollToBottom(false);
43414341
// activeThreadRef resets transitively with the active thread.
4342-
}, [activeThread?.id]);
4342+
// Scoped key: cloned state can repeat a bare thread id across
4343+
// environments, and per-thread view state must still reset then.
4344+
}, [activeThreadKey]);
43434345

43444346
useEffect(() => {
43454347
setIsRevertingCheckpoint(false);
4346-
}, [activeThread?.id]);
4348+
}, [activeThreadKey]);
43474349

43484350
useEffect(() => {
43494351
if (!activeThread?.id || terminalUiState.terminalOpen) return;
@@ -4353,7 +4355,7 @@ function ChatViewContent(props: ChatViewProps) {
43534355
return () => {
43544356
window.cancelAnimationFrame(frame);
43554357
};
4356-
}, [activeThread?.id, focusComposer, terminalUiState.terminalOpen]);
4358+
}, [activeThread?.id, activeThreadKey, focusComposer, terminalUiState.terminalOpen]);
43574359

43584360
useEffect(() => {
43594361
if (!activeThread?.id) return;
@@ -4964,7 +4966,7 @@ function ChatViewContent(props: ChatViewProps) {
49644966
useEffect(() => {
49654967
setPendingServerThreadEnvMode(null);
49664968
setPendingServerThreadBranch(undefined);
4967-
}, [activeThread?.id]);
4969+
}, [activeThreadKey]);
49684970

49694971
useEffect(() => {
49704972
if (canOverrideServerThreadEnvMode) {

0 commit comments

Comments
 (0)