From 624331472a179f355f1a72e134bde5c683198fe7 Mon Sep 17 00:00:00 2001 From: Nam Vu Date: Sat, 14 Sep 2024 18:05:19 +0700 Subject: [PATCH] fix: Improve scrolling behavior for Conversation Opener (#8437) Co-authored-by: crazywoola <427733928@qq.com> --- web/app/components/base/chat/chat/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx index 65e49eff67..68194193c4 100644 --- a/web/app/components/base/chat/chat/index.tsx +++ b/web/app/components/base/chat/chat/index.tsx @@ -109,9 +109,9 @@ const Chat: FC = ({ const userScrolledRef = useRef(false) const handleScrollToBottom = useCallback(() => { - if (chatContainerRef.current && !userScrolledRef.current) + if (chatList.length > 1 && chatContainerRef.current && !userScrolledRef.current) chatContainerRef.current.scrollTop = chatContainerRef.current.scrollHeight - }, []) + }, [chatList.length]) const handleWindowResize = useCallback(() => { if (chatContainerRef.current)