mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 07:05:56 +08:00
fix: chat scroll (#2981)
This commit is contained in:
parent
40dbf30784
commit
61f5de9662
@ -9,7 +9,6 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useThrottleEffect } from 'ahooks'
|
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
import type {
|
import type {
|
||||||
ChatConfig,
|
ChatConfig,
|
||||||
@ -92,10 +91,19 @@ const Chat: FC<ChatProps> = ({
|
|||||||
chatFooterInnerRef.current.style.width = `${chatContainerInnerRef.current.clientWidth}px`
|
chatFooterInnerRef.current.style.width = `${chatContainerInnerRef.current.clientWidth}px`
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useThrottleEffect(() => {
|
useEffect(() => {
|
||||||
handleScrolltoBottom()
|
handleScrolltoBottom()
|
||||||
handleWindowResize()
|
handleWindowResize()
|
||||||
}, [chatList], { wait: 500 })
|
}, [handleScrolltoBottom, handleWindowResize])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (chatContainerRef.current) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
handleScrolltoBottom()
|
||||||
|
handleWindowResize()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener('resize', debounce(handleWindowResize))
|
window.addEventListener('resize', debounce(handleWindowResize))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user