From 78f7acde87853b83cac30c4e56c4caf727b880e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Tue, 2 Aug 2022 19:01:45 +0200 Subject: [PATCH] Fix other name showing on typing (#6532) --- app/components/post_draft/typing/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/components/post_draft/typing/index.tsx b/app/components/post_draft/typing/index.tsx index dfa90b820..ce41af656 100644 --- a/app/components/post_draft/typing/index.tsx +++ b/app/components/post_draft/typing/index.tsx @@ -96,7 +96,7 @@ function Typing({ } else if (mounted.current) { setRefresh(Date.now()); } - }, []); + }, [channelId, rootId]); useEffect(() => { mounted.current = true; @@ -123,6 +123,15 @@ function Typing({ typingHeight.value = typing.current.length ? TYPING_HEIGHT : 0; }, [refresh]); + useEffect(() => { + typing.current = []; + typingHeight.value = 0; + if (timeoutToDisappear.current) { + clearTimeout(timeoutToDisappear.current); + timeoutToDisappear.current = undefined; + } + }, [channelId, rootId]); + const renderTyping = () => { const nextTyping = typing.current.map(({username}) => username);