Only attempt to maintain scroll position when prepending messages if there was previously any messages

This commit is contained in:
Ken-Håvard Lieng 2018-12-08 11:56:02 +01:00
parent 0e46fbcc82
commit 8f1105bc59
2 changed files with 54 additions and 54 deletions

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@ export default class MessageBox extends PureComponent {
if (prevProps.messages[0] !== this.props.messages[0]) {
const { messages, hasMoreMessages } = this.props;
if (prevProps.tab === this.props.tab) {
if (prevProps.tab === this.props.tab && prevProps.messages.length > 0) {
const addedMessages = messages.length - prevProps.messages.length;
let addedHeight = 0;
for (let i = 0; i < addedMessages; i++) {