From ddaa9b46c07937e92f8f09dc8919138097f54348 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 24 May 2021 16:38:28 +0530 Subject: [PATCH] Dispose vm preemptively Signed-off-by: RMidhunSuresh --- src/domain/session/SessionViewModel.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/domain/session/SessionViewModel.js b/src/domain/session/SessionViewModel.js index 1194bff4..e96ef6f9 100644 --- a/src/domain/session/SessionViewModel.js +++ b/src/domain/session/SessionViewModel.js @@ -253,15 +253,16 @@ export class SessionViewModel extends ViewModel { } _toggleRoomInformationPanel() { + this._roomInfoViewModel = this.disposeTracked(this._roomInfoViewModel); const roomId = this.navigation.path.get("room")?.value; const room = this._sessionContainer.session.rooms.get(roomId); - const enable = !!this.navigation.path.get("details"); if (!room) { return; } - this._roomInfoViewModel = enable ? - this.track(new RoomInfoViewModel(this.childOptions({ room }))) : - this.disposeTracked(this._roomInfoViewModel); + const enable = !!this.navigation.path.get("details"); + if (enable) { + this._roomInfoViewModel = this.track(new RoomInfoViewModel(this.childOptions({ room }))); + } this.emitChange("roomInfoViewModel"); }