From 9ea0138ffdc3e85be707e2ec46be61f13ae85259 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 11 May 2021 13:10:21 +0200 Subject: [PATCH] don't open room view when clearing room id --- src/domain/session/SessionViewModel.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/domain/session/SessionViewModel.js b/src/domain/session/SessionViewModel.js index c847ce79..ae697c72 100644 --- a/src/domain/session/SessionViewModel.js +++ b/src/domain/session/SessionViewModel.js @@ -195,6 +195,12 @@ export class SessionViewModel extends ViewModel { if (this._roomViewModelObservable) { this._roomViewModelObservable = this.disposeTracked(this._roomViewModelObservable); } + if (!roomId) { + // if clearing the activeMiddleViewModel rather than changing to a different one, + // emit so the view picks it up and show the placeholder + this.emitChange("activeMiddleViewModel"); + return; + } const vmo = new RoomViewModelObservable(this, roomId); this._roomViewModelObservable = this.track(vmo); // subscription is unsubscribed in RoomViewModelObservable.dispose, and thus handled by track