summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-14 22:43:49 -0700
committerNate Sesti <sestinj@gmail.com>2023-06-14 22:43:49 -0700
commit905db4aadb80b02ab4914f8c1c16fbaa68b2f117 (patch)
tree799db7416aea8a716103170c46682d47bfd3e70d
parentd05a9815233e26dc3aac35e3491c0f6bbe725022 (diff)
downloadsncontinue-905db4aadb80b02ab4914f8c1c16fbaa68b2f117.tar.gz
sncontinue-905db4aadb80b02ab4914f8c1c16fbaa68b2f117.tar.bz2
sncontinue-905db4aadb80b02ab4914f8c1c16fbaa68b2f117.zip
scrolling fix
-rw-r--r--extension/react-app/src/tabs/gui.tsx7
1 files changed, 5 insertions, 2 deletions
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);