use disposeTracked

This commit is contained in:
Bruno Windels 2021-08-06 17:56:02 +02:00
parent 3feaf38252
commit 2a92363317

View file

@ -27,13 +27,9 @@ export class ComposerViewModel extends ViewModel {
setReplyingTo(entry) { setReplyingTo(entry) {
const changed = this._replyVM?.internalId !== entry?.asEventKey().toString(); const changed = this._replyVM?.internalId !== entry?.asEventKey().toString();
if (changed) { if (changed) {
if (this._replyVM) { this._replyVM = this.disposeTracked(this._replyVM);
this.untrack(this._replyVM); if (entry) {
this._replyVM.dispose(); this._replyVM = this.track(this._roomVM._createTile(entry));
}
this._replyVM = entry && this._roomVM._createTile(entry);
if (this._replyVM) {
this.track(this._replyVM);
} }
this.emitChange("replyViewModel"); this.emitChange("replyViewModel");
} }