From a0e3848cf6381a211dd89410a571cf9eb098cc92 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 11 May 2021 16:39:33 +0200 Subject: [PATCH] dispose existing view model when changing status, otherwise we leak! --- src/domain/session/RoomViewModelObservable.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/domain/session/RoomViewModelObservable.js b/src/domain/session/RoomViewModelObservable.js index 02b63d3d..9252ee81 100644 --- a/src/domain/session/RoomViewModelObservable.js +++ b/src/domain/session/RoomViewModelObservable.js @@ -51,6 +51,8 @@ export class RoomViewModelObservable extends ObservableValue { this._statusObservable = await session.observeRoomStatus(this.id); this.set(await this._statusToViewModel(this._statusObservable.get())); this._statusObservable.subscribe(async status => { + // first dispose existing VM, if any + this.get()?.dispose(); this.set(await this._statusToViewModel(status)); }); }