mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Create new tiles instead of keeping old ones
This commit is contained in:
parent
434882069e
commit
21b067eaff
@ -5,13 +5,23 @@ export class ComposerViewModel extends ViewModel {
|
||||
super();
|
||||
this._roomVM = roomVM;
|
||||
this._isEmpty = true;
|
||||
this._replyId = null;
|
||||
this._replyVM = null;
|
||||
}
|
||||
|
||||
setReplyingTo(tile) {
|
||||
const changed = this._replyVM !== tile;
|
||||
this._replyVM = tile;
|
||||
setReplyingTo(entry) {
|
||||
const newId = entry?.id || null;
|
||||
const changed = this._replyId !== newId;
|
||||
if (changed) {
|
||||
this._replyId = newId;
|
||||
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.emitChange("replyViewModel");
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,10 @@ export class RoomViewModel extends ViewModel {
|
||||
rejoinRoom() {
|
||||
this._room.join();
|
||||
}
|
||||
|
||||
_createTile(entry) {
|
||||
return this._tilesCreator(entry);
|
||||
}
|
||||
|
||||
async _sendMessage(message, replyingTo) {
|
||||
if (!this._room.isArchived && message) {
|
||||
|
@ -107,7 +107,7 @@ export class BaseMessageTile extends SimpleTile {
|
||||
}
|
||||
|
||||
startReply() {
|
||||
this._roomVM.startReply(this);
|
||||
this._roomVM.startReply(this._entry);
|
||||
}
|
||||
|
||||
reply(msgtype, body, log = null) {
|
||||
|
Loading…
Reference in New Issue
Block a user