소스 검색

fix: Improve scrolling behavior for Conversation Opener (#8437)

Co-authored-by: crazywoola <427733928@qq.com>
Nam Vu 7 달 전
부모
커밋
624331472a
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      web/app/components/base/chat/chat/index.tsx

+ 2 - 2
web/app/components/base/chat/chat/index.tsx

@@ -109,9 +109,9 @@ const Chat: FC<ChatProps> = ({
   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)