Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Fix chat error with only a single message

Gabe Kangas33fd2199c6db
diff --git a/web/components/chat/ChatContainer/ChatContainer.tsx b/web/components/chat/ChatContainer/ChatContainer.tsx
index 3d998a7765..817a0c0f78 100644
--- a/web/components/chat/ChatContainer/ChatContainer.tsx
+++ b/web/components/chat/ChatContainer/ChatContainer.tsx
@@ -160,12 +160,16 @@ export default function ChatContainer(props: Props) {
}
function isSameUserAsLast(messages: ChatMessage[], index: number): boolean {
+ if (messages.length < 2) {
+ return false;
+ }
+
const message = messages[index];
const {
user: { id },
} = message;
const lastMessage = messages[index - 1];
- if (lastMessage.type !== MessageType.CHAT) {
+ if (lastMessage?.type !== MessageType.CHAT) {
return false;
}