ソースを参照

fix: debounce ref (#26433)

tags/1.9.1
crazywoola 1ヶ月前
コミット
fd86cadf67
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更7行の追加2行の削除
  1. 7
    2
      web/app/components/base/chat/chat/index.tsx

+ 7
- 2
web/app/components/base/chat/chat/index.tsx ファイルの表示

@@ -160,8 +160,13 @@ const Chat: FC<ChatProps> = ({
})

useEffect(() => {
window.addEventListener('resize', debounce(handleWindowResize))
return () => window.removeEventListener('resize', handleWindowResize)
const debouncedHandler = debounce(handleWindowResize, 200)
window.addEventListener('resize', debouncedHandler)

return () => {
window.removeEventListener('resize', debouncedHandler)
debouncedHandler.cancel()
}
}, [handleWindowResize])

useEffect(() => {

読み込み中…
キャンセル
保存