diff --git a/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js b/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js index e0376f0b0..86ca1f196 100644 --- a/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js +++ b/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js @@ -43,8 +43,9 @@ const ChatInputFormattingToolbar = ({ const handleEmojiClick = (emojiEvent) => { const [emoji] = emojiEvent.names; - const updatedMessageWithEmoji = - messageRef.current.value + ` :${emoji.replace(/[\s-]+/g, '_')}: `; + const updatedMessageWithEmoji = `${ + messageRef.current.value ?? '' + } :${emoji.replace(/[\s-]+/g, '_')}: `; messageRef.current.value = updatedMessageWithEmoji; onTextChange({ target: { value: updatedMessageWithEmoji } }); };