From 6bf8e976cb05bf728e2aa165946c0eea64ac6f1f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 19 Oct 2020 13:39:19 +0200 Subject: [PATCH] don't assign timelineVM before loaded, so prop doesn't return it ... if the binding happens to be evaluating (which it was during mount) follow-up from bwindels/fix-crash-switch-rooms-too-fast --- src/domain/session/room/RoomViewModel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 188f3d1c..5aa20a2a 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -41,12 +41,13 @@ export class RoomViewModel extends ViewModel { async load() { this._room.on("change", this._onRoomChange); try { - this._timelineVM = this.track(new TimelineViewModel(this.childOptions({ + const timelineVM = this.track(new TimelineViewModel(this.childOptions({ room: this._room, timeline: this._room.openTimeline(), ownUserId: this._ownUserId, }))); - await this._timelineVM.load(); + await timelineVM.load(); + this._timelineVM = timelineVM; this.emitChange("timelineViewModel"); } catch (err) { console.error(`room.openTimeline(): ${err.message}:\n${err.stack}`);