Sfoglia il codice sorgente

fix: debounce ref (#26433)

tags/1.9.1
crazywoola 1 mese fa
parent
commit
fd86cadf67
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7
    2
      web/app/components/base/chat/chat/index.tsx

+ 7
- 2
web/app/components/base/chat/chat/index.tsx Vedi 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…
Annulla
Salva