No need to set options in WillStartClient

We can set them any time up to that point
This commit is contained in:
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; this.matrixClient = null;
// These are the default options used when Lifecycle.js // These are the default options used when Lifecycle.js
// starts the client. These can be altered when the // starts the client. These can be altered at any
// 'will_start_client' event is dispatched. // time up to after the 'will_start_client' event is
// finished processing.
this.opts = { this.opts = {
initialSyncLimit: 20, initialSyncLimit: 20,
}; };

View file

@ -146,6 +146,10 @@ module.exports = React.createClass({
// whilst logged in as a guest user (so they can change // whilst logged in as a guest user (so they can change
// their mind & log back in) // their mind & log back in)
this.guestCreds = null; this.guestCreds = null;
if (this.props.config.sync_timeline_limit) {
MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit;
}
}, },
componentDidMount: function() { componentDidMount: function() {
@ -601,15 +605,11 @@ module.exports = React.createClass({
/** /**
* Called just before the matrix client is started * Called just before the matrix client is started
* (useful for setting options and listeners) * (useful for setting listeners)
*/ */
_onWillStartClient() { _onWillStartClient() {
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
if (this.props.config.sync_timeline_limit) {
MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit;
}
var self = this; var self = this;
cli.on('sync', function(state, prevState) { cli.on('sync', function(state, prevState) {
self.updateFavicon(state, prevState); self.updateFavicon(state, prevState);