diff --git a/src/components/room/widgets/chat/ChatWidgetMessageView.tsx b/src/components/room/widgets/chat/ChatWidgetMessageView.tsx index 12818db2..4385b3b6 100644 --- a/src/components/room/widgets/chat/ChatWidgetMessageView.tsx +++ b/src/components/room/widgets/chat/ChatWidgetMessageView.tsx @@ -14,6 +14,7 @@ export const ChatWidgetMessageView: FC = props => const { chat = null, makeRoom = null, onChatClicked = null } = props; const [ isVisible, setIsVisible ] = useState(false); const elementRef = useRef(); + const [formatted, setFormatted] = useState(null); const onMouseDown = (event: MouseEvent) => onChatClicked(chat); @@ -49,13 +50,13 @@ export const ChatWidgetMessageView: FC = props => chat.visible = true; } - chat.text = RoomChatFormatter(chat.text); + if(!formatted) setFormatted(RoomChatFormatter(chat.text)); return () => { chat.elementRef = null; } - }, [ elementRef, chat, makeRoom ]); + }, [ elementRef, chat, makeRoom,formatted ]); useEffect(() => setIsVisible(chat.visible), [ chat.visible ]); @@ -68,7 +69,7 @@ export const ChatWidgetMessageView: FC = props =>
- +