Add comment to explain sync_state dispatch

This commit is contained in:
Luke Barnard 2017-05-25 09:30:57 +01:00
parent fffe425730
commit 8fc44a9b66

View file

@ -895,6 +895,11 @@ module.exports = React.createClass({
}); });
cli.on('sync', function(state, prevState) { cli.on('sync', function(state, prevState) {
// LifecycleStore and others cannot directly subscribe to matrix client for
// events because flux only allows store state changes during flux dispatches.
// So dispatch directly from here. Ideally we'd use a SyncStateStore that
// would do this dispatch and expose the sync state itself (by listening to
// its own dispatch).
dis.dispatch({action: 'sync_state', prevState, state}); dis.dispatch({action: 'sync_state', prevState, state});
self.updateStatusIndicator(state, prevState); self.updateStatusIndicator(state, prevState);
if (state === "SYNCING" && prevState === "SYNCING") { if (state === "SYNCING" && prevState === "SYNCING") {