push to navigation in SessionViewModel rather than RVO

This commit is contained in:
Bruno Windels 2022-02-10 14:57:48 +01:00
parent 2c1b29e637
commit b0d790543a
2 changed files with 4 additions and 1 deletions

View file

@ -64,7 +64,7 @@ export class RoomViewModelObservable extends ObservableValue {
if (status & RoomStatus.BeingCreated) { if (status & RoomStatus.BeingCreated) {
const {session} = this._sessionViewModel._client; const {session} = this._sessionViewModel._client;
const roomBeingCreated = session.roomsBeingCreated.get(this.id); const roomBeingCreated = session.roomsBeingCreated.get(this.id);
this._sessionViewModel.navigation.push("room", roomBeingCreated.roomId); this._sessionViewModel.notifyRoomReplaced(roomBeingCreated.id, roomBeingCreated.roomId);
} else { } else {
throw new Error("Don't know how to replace a room with this status: " + (status ^ RoomStatus.Replaced)); throw new Error("Don't know how to replace a room with this status: " + (status ^ RoomStatus.Replaced));
} }

View file

@ -298,4 +298,7 @@ export class SessionViewModel extends ViewModel {
this.emitChange("rightPanelViewModel"); this.emitChange("rightPanelViewModel");
} }
notifyRoomReplaced(oldId, newId) {
this.navigation.push("room", newId);
}
} }