From 2c6a3a7ce76caf22e83e4e38b30ac605ce22cc1a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 21 Sep 2020 13:55:35 +0200 Subject: [PATCH] fix afterSyncCompleted not being run after a sync error occurs the error was not cleared when calling start again. Also we should better look at the sync status to decide whether to run afterSyncCompleted. This prevented the room keys from being applied once you had a connection error or other error at some point since you started the app. --- src/matrix/Sync.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix/Sync.js b/src/matrix/Sync.js index fe2a2bed..4ff55319 100644 --- a/src/matrix/Sync.js +++ b/src/matrix/Sync.js @@ -82,6 +82,7 @@ export class Sync { if (this._status.get() !== SyncStatus.Stopped) { return; } + this._error = null; let syncToken = this._session.syncToken; if (syncToken) { this._status.set(SyncStatus.CatchupSync); @@ -111,7 +112,7 @@ export class Sync { this._status.set(SyncStatus.Stopped); } } - if (!this._error) { + if (this._status.get() !== SyncStatus.Stopped) { afterSyncCompletedPromise = this._runAfterSyncCompleted(roomStates); } }