Browse Source

Cap the number of renderable messages to increase performance

pull/1469/head
Gabe Kangas 4 years ago
parent
commit
a6ba61079f
  1. 3
      webroot/js/components/chat/chat.js

3
webroot/js/components/chat/chat.js

@ -212,6 +212,9 @@ export default class Chat extends Component { @@ -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,
});

Loading…
Cancel
Save