mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 02:46:52 +08:00
fix: chat scroll (#2981)
This commit is contained in:
@@ -9,7 +9,6 @@ import {
|
||||
useRef,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useThrottleEffect } from 'ahooks'
|
||||
import { debounce } from 'lodash-es'
|
||||
import type {
|
||||
ChatConfig,
|
||||
@@ -92,10 +91,19 @@ const Chat: FC<ChatProps> = ({
|
||||
chatFooterInnerRef.current.style.width = `${chatContainerInnerRef.current.clientWidth}px`
|
||||
}, [])
|
||||
|
||||
useThrottleEffect(() => {
|
||||
useEffect(() => {
|
||||
handleScrolltoBottom()
|
||||
handleWindowResize()
|
||||
}, [chatList], { wait: 500 })
|
||||
}, [handleScrolltoBottom, handleWindowResize])
|
||||
|
||||
useEffect(() => {
|
||||
if (chatContainerRef.current) {
|
||||
requestAnimationFrame(() => {
|
||||
handleScrolltoBottom()
|
||||
handleWindowResize()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('resize', debounce(handleWindowResize))
|
||||
|
||||
Reference in New Issue
Block a user