diff --git a/webroot/js/components/chat/chat.js b/webroot/js/components/chat/chat.js index 169dfb321..97afc7fb6 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, });