From e0673eee29375952a4d7cc8f9c5212664585ce06 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 20 Jul 2015 14:09:41 -0700 Subject: [PATCH] Don't go & load the first room if we've already been told to load a different one. --- src/controllers/pages/MatrixChat.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index 6ff62c969..21c40467a 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -173,14 +173,18 @@ module.exports = { var cli = MatrixClientPeg.get(); var self = this; cli.on('syncComplete', function() { - var firstRoom = null; - if (cli.getRooms() && cli.getRooms().length) { - firstRoom = RoomListSorter.mostRecentActivityFirst( - cli.getRooms() - )[0].roomId; + if (!self.state.currentRoom) { + var firstRoom = null; + if (cli.getRooms() && cli.getRooms().length) { + firstRoom = RoomListSorter.mostRecentActivityFirst( + cli.getRooms() + )[0].roomId; + } + self.setState({ready: true, currentRoom: firstRoom}); + self.notifyNewScreen('room/'+firstRoom); + } else { + self.setState({ready: true}); } - self.setState({ready: true, currentRoom: firstRoom}); - self.notifyNewScreen('room/'+firstRoom); dis.dispatch({action: 'focus_composer'}); }); cli.on('Call.incoming', function(call) {