From 65f351ff2276f7790ba68a1393cd05b48413e59b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 15 Jun 2017 02:15:13 +0100 Subject: [PATCH] Clear Lifecycle.RtsClient on MatrixChat.mount - otherwise it ends up sitting around and failing later tests. --- src/Lifecycle.js | 6 +++++- src/components/structures/MatrixChat.js | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Lifecycle.js b/src/Lifecycle.js index 338341f403..39a159869c 100644 --- a/src/Lifecycle.js +++ b/src/Lifecycle.js @@ -265,7 +265,11 @@ function _handleRestoreFailure(e) { let rtsClient = null; export function initRtsClient(url) { - rtsClient = new RtsClient(url); + if (url) { + rtsClient = new RtsClient(url); + } else { + rtsClient = null; + } } /** diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index ed1cd183a7..efca22cc85 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -263,11 +263,8 @@ module.exports = React.createClass({ window.addEventListener('resize', this.handleResize); this.handleResize(); - if (this.props.config.teamServerConfig && - this.props.config.teamServerConfig.teamServerURL - ) { - Lifecycle.initRtsClient(this.props.config.teamServerConfig.teamServerURL); - } + const teamServerConfig = this.props.config.teamServerConfig || {}; + Lifecycle.initRtsClient(teamServerConfig.teamServerURL); // if the user has followed a login or register link, don't reanimate // the old creds, but rather go straight to the relevant page