From 4825ab8fe78b3ddab42f73250932833d5ae61c3b Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 3 Aug 2016 09:53:02 +0100 Subject: [PATCH] No need to set options in WillStartClient We can set them any time up to that point --- src/MatrixClientPeg.js | 5 +++-- src/components/structures/MatrixChat.js | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 49326cc22f..54e4cbb646 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -42,8 +42,9 @@ class MatrixClientPeg { this.matrixClient = null; // These are the default options used when Lifecycle.js - // starts the client. These can be altered when the - // 'will_start_client' event is dispatched. + // starts the client. These can be altered at any + // time up to after the 'will_start_client' event is + // finished processing. this.opts = { initialSyncLimit: 20, }; diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index ca7437754b..47cbde9af5 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -146,6 +146,10 @@ module.exports = React.createClass({ // whilst logged in as a guest user (so they can change // their mind & log back in) this.guestCreds = null; + + if (this.props.config.sync_timeline_limit) { + MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit; + } }, componentDidMount: function() { @@ -601,15 +605,11 @@ module.exports = React.createClass({ /** * Called just before the matrix client is started - * (useful for setting options and listeners) + * (useful for setting listeners) */ _onWillStartClient() { var cli = MatrixClientPeg.get(); - if (this.props.config.sync_timeline_limit) { - MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit; - } - var self = this; cli.on('sync', function(state, prevState) { self.updateFavicon(state, prevState);