From e2348c50d51a4ba49825145627d5afd4a0a08f21 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 16 Jun 2015 14:37:15 +0100 Subject: [PATCH] Fix logout --- src/organisms/RoomView.js | 4 +++- src/pages/MatrixChat.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/organisms/RoomView.js b/src/organisms/RoomView.js index 4a682c8b..7b4e9a4b 100644 --- a/src/organisms/RoomView.js +++ b/src/organisms/RoomView.js @@ -17,7 +17,9 @@ module.exports = React.createClass({ }, componentWillUnmount: function() { - MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); + if (MatrixClientPeg.get()) { + MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); + } }, componentWillReceiveProps: function(props) { diff --git a/src/pages/MatrixChat.js b/src/pages/MatrixChat.js index 7b260657..5327031a 100644 --- a/src/pages/MatrixChat.js +++ b/src/pages/MatrixChat.js @@ -33,11 +33,12 @@ module.exports = React.createClass({ onAction: function(payload) { switch (payload.action) { case 'logout': - mxCliPeg.replace(null); this.setState({ logged_in: false, ready: false }); + mxCliPeg.get().removeAllListeners(); + mxCliPeg.replace(null); break; case 'view_room': this.setState({