Skip to content

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

Cap the number of renderable messages to increase performance

Gabe Kangas166b30c481c8
diff --git a/webroot/js/components/chat/chat.js b/webroot/js/components/chat/chat.js
index 169dfb3215..97afc7fb6d 100644
--- a/webroot/js/components/chat/chat.js
+++ b/webroot/js/components/chat/chat.js
@@ -212,6 +212,9 @@ export default class Chat extends Component {
);
});
updatedMessageList.splice(insertAtIndex + 1, 0, convertedMessage);
+ if (updatedMessageList.length > 300) {
+ updatedMessageList = updatedMessageList.slice(Math.max(updatedMessageList.length - 300, 0));
+ }
this.setState({
messages: updatedMessageList,
});