From 2a923633173ece4c498a3a69ecd65c02dea38139 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 6 Aug 2021 17:56:02 +0200 Subject: [PATCH] use disposeTracked --- src/domain/session/room/ComposerViewModel.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/domain/session/room/ComposerViewModel.js b/src/domain/session/room/ComposerViewModel.js index d3ee27a0..3ee7f8e3 100644 --- a/src/domain/session/room/ComposerViewModel.js +++ b/src/domain/session/room/ComposerViewModel.js @@ -27,13 +27,9 @@ export class ComposerViewModel extends ViewModel { setReplyingTo(entry) { const changed = this._replyVM?.internalId !== entry?.asEventKey().toString(); if (changed) { - if (this._replyVM) { - this.untrack(this._replyVM); - this._replyVM.dispose(); - } - this._replyVM = entry && this._roomVM._createTile(entry); - if (this._replyVM) { - this.track(this._replyVM); + this._replyVM = this.disposeTracked(this._replyVM); + if (entry) { + this._replyVM = this.track(this._roomVM._createTile(entry)); } this.emitChange("replyViewModel"); }