summaryrefslogtreecommitdiff
path: root/extension/react-app/src/tabs/gui.tsx
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
commit5da6577d62beeb21ce6f43ae85893c26e1028601 (patch)
tree14d0b8c374fdd9bc54a3f08861241d6dab8c9baf /extension/react-app/src/tabs/gui.tsx
parent7b08dfd5af073dfe5b12f52d3427ae03c4313ea6 (diff)
downloadsncontinue-5da6577d62beeb21ce6f43ae85893c26e1028601.tar.gz
sncontinue-5da6577d62beeb21ce6f43ae85893c26e1028601.tar.bz2
sncontinue-5da6577d62beeb21ce6f43ae85893c26e1028601.zip
scrolling fix
Diffstat (limited to 'extension/react-app/src/tabs/gui.tsx')
-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);