Skip to content

Commit 5082fcb

Browse files
committed
Fix: cancel scroll-to-bottom debouncer on unmount to prevent stale state updates
1 parent c74144d commit 5082fcb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

apps/web/src/components/ChatView.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,12 @@ export default function ChatView(props: ChatViewProps) {
19691969
planSidebarDismissedForTurnRef.current = null;
19701970
}, [activeThread?.id]);
19711971

1972+
// Cancel any pending debouncer timeout on unmount to avoid stale state updates.
1973+
useEffect(() => {
1974+
const debouncer = showScrollDebouncer.current;
1975+
return () => debouncer.cancel();
1976+
}, []);
1977+
19721978
useEffect(() => {
19731979
setIsRevertingCheckpoint(false);
19741980
}, [activeThread?.id]);

0 commit comments

Comments
 (0)