Selaa lähdekoodia

fix: debounce ref (#26433)

tags/1.9.1
crazywoola 1 kuukausi sitten
vanhempi
commit
fd86cadf67
No account linked to committer's email address
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 7
    2
      web/app/components/base/chat/chat/index.tsx

+ 7
- 2
web/app/components/base/chat/chat/index.tsx Näytä tiedosto

@@ -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…
Peruuta
Tallenna