mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Bypass the tests being weird
They run kinda-but-not-really async, which can lead to early/late calls to `stop()`
This commit is contained in:
parent
3c45a39caa
commit
07b8e128d2
1 changed files with 8 additions and 1 deletions
|
@ -66,7 +66,14 @@ export class Mjolnir {
|
|||
|
||||
stop() {
|
||||
SettingsStore.unwatchSetting(this._mjolnirWatchRef);
|
||||
dis.unregister(this._dispatcherRef);
|
||||
|
||||
try {
|
||||
if (this._dispatcherRef) dis.unregister(this._dispatcherRef);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// Only the tests cause problems with this particular block of code. We should
|
||||
// never be here in production.
|
||||
}
|
||||
|
||||
if (!MatrixClientPeg.get()) return;
|
||||
MatrixClientPeg.get().removeListener("RoomState.events", this._onEvent.bind(this));
|
||||
|
|
Loading…
Reference in a new issue