forked from mystiq/hydrogen-web
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.
This commit is contained in:
parent
79ac939c8f
commit
2c6a3a7ce7
1 changed files with 2 additions and 1 deletions
|
@ -82,6 +82,7 @@ export class Sync {
|
||||||
if (this._status.get() !== SyncStatus.Stopped) {
|
if (this._status.get() !== SyncStatus.Stopped) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._error = null;
|
||||||
let syncToken = this._session.syncToken;
|
let syncToken = this._session.syncToken;
|
||||||
if (syncToken) {
|
if (syncToken) {
|
||||||
this._status.set(SyncStatus.CatchupSync);
|
this._status.set(SyncStatus.CatchupSync);
|
||||||
|
@ -111,7 +112,7 @@ export class Sync {
|
||||||
this._status.set(SyncStatus.Stopped);
|
this._status.set(SyncStatus.Stopped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this._error) {
|
if (this._status.get() !== SyncStatus.Stopped) {
|
||||||
afterSyncCompletedPromise = this._runAfterSyncCompleted(roomStates);
|
afterSyncCompletedPromise = this._runAfterSyncCompleted(roomStates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue