From 434abbc66f62ed26fe1f94ec3512fbe0a8f6f6bf Mon Sep 17 00:00:00 2001 From: Alexey Bogomolov Date: Thu, 11 Jan 2024 02:19:22 +0300 Subject: [PATCH] use config to drive autoscroll state --- app/components/chat.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 39abdd97b..bde807476 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -379,12 +379,13 @@ function useScrollToBottom() { // for auto-scroll const scrollRef = useRef(null); const [autoScroll, setAutoScroll] = useState(true); - + const config = useAppConfig(); + let isAutoScrollEnabled: boolean = config.autoScrollMessage; function scrollDomToBottom() { const dom = scrollRef.current; if (dom) { requestAnimationFrame(() => { - setAutoScroll(true); + setAutoScroll(isAutoScrollEnabled); dom.scrollTo(0, dom.scrollHeight); }); }