From c5320d786c4bc83ea1f151132bf6e98039d20e02 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 26 May 2026 16:13:00 +0000 Subject: [PATCH] Avoid render-time refs in drawer height hook Co-authored-by: Julius Marminge --- .../src/components/ThreadTerminalDrawer.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx index 17cd06af3a..f0fa77750a 100644 --- a/apps/web/src/components/ThreadTerminalDrawer.tsx +++ b/apps/web/src/components/ThreadTerminalDrawer.tsx @@ -79,8 +79,13 @@ function useThreadDrawerHeight(threadId: ThreadId, height: number) { const drawerHeightRef = useRef(drawerHeight); const lastSyncedHeightRef = useRef(clampedSourceHeight); - drawerHeightRef.current = drawerHeight; - lastSyncedHeightRef.current = clampedSourceHeight; + useEffect(() => { + drawerHeightRef.current = drawerHeight; + }, [drawerHeight]); + + useEffect(() => { + lastSyncedHeightRef.current = clampedSourceHeight; + }, [clampedSourceHeight]); const setDrawerHeight = useCallback( (nextHeight: number) => { @@ -918,13 +923,8 @@ export default function ThreadTerminalDrawer({ keybindings, }: ThreadTerminalDrawerProps) { const [resizeEpoch, setResizeEpoch] = useState(0); - const { - drawerHeight, - drawerHeightRef, - lastSyncedHeightRef, - setDrawerHeight, - clearDrawerHeight, - } = useThreadDrawerHeight(threadId, height); + const { drawerHeight, drawerHeightRef, lastSyncedHeightRef, setDrawerHeight, clearDrawerHeight } = + useThreadDrawerHeight(threadId, height); const resizeStateRef = useRef<{ pointerId: number; startY: number;