add update parameter when replacing tile
This commit is contained in:
parent
932542bea0
commit
77dca5dd55
3 changed files with 8 additions and 6 deletions
|
@ -150,7 +150,8 @@ export class TilesCollection extends BaseObservableList {
|
|||
if (action.shouldReplace) {
|
||||
const newTile = this._tileCreator(entry);
|
||||
if (newTile) {
|
||||
this._replaceTile(tileIdx, tile, newTile);
|
||||
this._replaceTile(tileIdx, tile, newTile, action.updateParams);
|
||||
newTile.setUpdateEmit(this._emitSpontanousUpdate);
|
||||
} else {
|
||||
this._removeTile(tileIdx, tile);
|
||||
}
|
||||
|
@ -175,7 +176,7 @@ export class TilesCollection extends BaseObservableList {
|
|||
// merge with neighbours? ... hard to imagine use case for this ...
|
||||
}
|
||||
|
||||
_replaceTile(tileIdx, existingTile, newTile) {
|
||||
_replaceTile(tileIdx, existingTile, newTile, updateParams) {
|
||||
existingTile.dispose();
|
||||
const prevTile = this._getTileAtIdx(tileIdx - 1);
|
||||
const nextTile = this._getTileAtIdx(tileIdx + 1);
|
||||
|
@ -184,7 +185,7 @@ export class TilesCollection extends BaseObservableList {
|
|||
newTile.updatePreviousSibling(prevTile);
|
||||
newTile.updateNextSibling(nextTile);
|
||||
nextTile?.updatePreviousSibling(newTile);
|
||||
this.emitUpdate(tileIdx, newTile, null);
|
||||
this.emitUpdate(tileIdx, newTile, updateParams);
|
||||
}
|
||||
|
||||
_removeTile(tileIdx, tile) {
|
||||
|
|
|
@ -50,7 +50,7 @@ export class UpdateAction {
|
|||
return new UpdateAction(false, false, false, null);
|
||||
}
|
||||
|
||||
static Replace() {
|
||||
return new UpdateAction(false, false, true, null);
|
||||
static Replace(params) {
|
||||
return new UpdateAction(false, false, true, params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ export class EncryptedEventTile extends MessageTile {
|
|||
const parentResult = super.updateEntry(entry, params);
|
||||
// event got decrypted, recreate the tile and replace this one with it
|
||||
if (entry.eventType !== "m.room.encrypted") {
|
||||
return UpdateAction.Replace();
|
||||
// the "shape" parameter trigger tile recreation in TimelineList
|
||||
return UpdateAction.Replace("shape");
|
||||
} else {
|
||||
return parentResult;
|
||||
}
|
||||
|
|
Reference in a new issue