Browse Source

fix: debounce ref (#26433)

tags/1.9.1
crazywoola 1 month ago
parent
commit
fd86cadf67
No account linked to committer's email address
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      web/app/components/base/chat/chat/index.tsx

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

@@ -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(() => {

Loading…
Cancel
Save