mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Merge pull request #65 from vector-im/bwindels/close-room-properly
close the room tile view model as well when closing a room
This commit is contained in:
commit
26cc5087d5
@ -57,24 +57,20 @@ export class SessionViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_closeCurrentRoom() {
|
_closeCurrentRoom() {
|
||||||
if (this._currentRoomViewModel) {
|
this._currentRoomTileViewModel?.close();
|
||||||
this._currentRoomViewModel = this.disposeTracked(this._currentRoomViewModel);
|
this._currentRoomViewModel = this.disposeTracked(this._currentRoomViewModel);
|
||||||
this.emitChange("currentRoom");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_openRoom(room, roomTileVM) {
|
_openRoom(room, roomTileVM) {
|
||||||
if (this._currentRoomTileViewModel) {
|
this._closeCurrentRoom();
|
||||||
this._currentRoomTileViewModel.close();
|
|
||||||
}
|
|
||||||
this._currentRoomTileViewModel = roomTileVM;
|
this._currentRoomTileViewModel = roomTileVM;
|
||||||
if (this._currentRoomViewModel) {
|
|
||||||
this._currentRoomViewModel = this.disposeTracked(this._currentRoomViewModel);
|
|
||||||
}
|
|
||||||
this._currentRoomViewModel = this.track(new RoomViewModel(this.childOptions({
|
this._currentRoomViewModel = this.track(new RoomViewModel(this.childOptions({
|
||||||
room,
|
room,
|
||||||
ownUserId: this._session.user.id,
|
ownUserId: this._session.user.id,
|
||||||
closeCallback: () => this._closeCurrentRoom(),
|
closeCallback: () => {
|
||||||
|
this._closeCurrentRoom();
|
||||||
|
this.emitChange("currentRoom");
|
||||||
|
},
|
||||||
})));
|
})));
|
||||||
this._currentRoomViewModel.load();
|
this._currentRoomViewModel.load();
|
||||||
this.emitChange("currentRoom");
|
this.emitChange("currentRoom");
|
||||||
|
Loading…
Reference in New Issue
Block a user