No need to set options in WillStartClient

We can set them any time up to that point
pull/21833/head
David Baker 2016-08-03 09:53:02 +01:00
parent 0c2bd10594
commit 4825ab8fe7
2 changed files with 8 additions and 7 deletions

View File

@ -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,
};

View File

@ -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);