From 905db4aadb80b02ab4914f8c1c16fbaa68b2f117 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 14 Jun 2023 22:43:49 -0700 Subject: scrolling fix --- extension/react-app/src/tabs/gui.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'extension/react-app/src/tabs') diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 70bab352..5316f42b 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -212,12 +212,15 @@ function GUI(props: GUIProps) { useEffect(() => { console.log("CLIENT ON STATE UPDATE: ", client, client?.onStateUpdate); client?.onStateUpdate((state) => { - console.log("Received state update: ", state); + // Scroll only if user is at very bottom of the window. + const shouldScrollToBottom = window.outerHeight - window.scrollY < 200; setWaitingForSteps(state.active); setHistory(state.history); setUserInputQueue(state.user_input_queue); - scrollToBottom(); + if (shouldScrollToBottom) { + scrollToBottom(); + } }); client?.onAvailableSlashCommands((commands) => { console.log("Received available slash commands: ", commands); -- cgit v1.2.3-70-g09d2