Skip to content

Commit 7841a38

Browse files
committed
fix(Lobby): Clean the room on destroy.
1 parent b3ae520 commit 7841a38

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/xmpp/Lobby.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ export default class Lobby {
309309
this.lobbyRoom.addEventListener(
310310
XMPPEvents.MUC_DESTROYED,
311311
(reason, jid) => {
312+
this.lobbyRoom?.clean();
313+
314+
this.lobbyRoom = undefined;
315+
logger.info('Lobby room left(destroyed)!');
316+
312317
// we are receiving the jid of the main room
313318
// means we are invited to join, maybe lobby was disabled
314319
if (jid) {
@@ -317,8 +322,6 @@ export default class Lobby {
317322
return;
318323
}
319324

320-
this.lobbyRoom.clean();
321-
322325
this.mainRoom.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
323326
});
324327

@@ -327,7 +330,9 @@ export default class Lobby {
327330
this.mainRoom.addEventListener(
328331
XMPPEvents.MUC_JOINED,
329332
() => {
330-
this.leave();
333+
this.leave().catch(() => {
334+
// this may happen if the room has been destroyed.
335+
});
331336
});
332337
}
333338

0 commit comments

Comments
 (0)