Przeglądaj źródła

fix: debounce ref (#26433)

tags/1.9.1
crazywoola 1 miesiąc temu
rodzic
commit
fd86cadf67
No account linked to committer's email address
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7
    2
      web/app/components/base/chat/chat/index.tsx

+ 7
- 2
web/app/components/base/chat/chat/index.tsx Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz