mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
add update parameter when replacing tile
This commit is contained in:
parent
932542bea0
commit
77dca5dd55
@ -150,7 +150,8 @@ export class TilesCollection extends BaseObservableList {
|
|||||||
if (action.shouldReplace) {
|
if (action.shouldReplace) {
|
||||||
const newTile = this._tileCreator(entry);
|
const newTile = this._tileCreator(entry);
|
||||||
if (newTile) {
|
if (newTile) {
|
||||||
this._replaceTile(tileIdx, tile, newTile);
|
this._replaceTile(tileIdx, tile, newTile, action.updateParams);
|
||||||
|
newTile.setUpdateEmit(this._emitSpontanousUpdate);
|
||||||
} else {
|
} else {
|
||||||
this._removeTile(tileIdx, tile);
|
this._removeTile(tileIdx, tile);
|
||||||
}
|
}
|
||||||
@ -175,7 +176,7 @@ export class TilesCollection extends BaseObservableList {
|
|||||||
// merge with neighbours? ... hard to imagine use case for this ...
|
// merge with neighbours? ... hard to imagine use case for this ...
|
||||||
}
|
}
|
||||||
|
|
||||||
_replaceTile(tileIdx, existingTile, newTile) {
|
_replaceTile(tileIdx, existingTile, newTile, updateParams) {
|
||||||
existingTile.dispose();
|
existingTile.dispose();
|
||||||
const prevTile = this._getTileAtIdx(tileIdx - 1);
|
const prevTile = this._getTileAtIdx(tileIdx - 1);
|
||||||
const nextTile = this._getTileAtIdx(tileIdx + 1);
|
const nextTile = this._getTileAtIdx(tileIdx + 1);
|
||||||
@ -184,7 +185,7 @@ export class TilesCollection extends BaseObservableList {
|
|||||||
newTile.updatePreviousSibling(prevTile);
|
newTile.updatePreviousSibling(prevTile);
|
||||||
newTile.updateNextSibling(nextTile);
|
newTile.updateNextSibling(nextTile);
|
||||||
nextTile?.updatePreviousSibling(newTile);
|
nextTile?.updatePreviousSibling(newTile);
|
||||||
this.emitUpdate(tileIdx, newTile, null);
|
this.emitUpdate(tileIdx, newTile, updateParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeTile(tileIdx, tile) {
|
_removeTile(tileIdx, tile) {
|
||||||
|
@ -50,7 +50,7 @@ export class UpdateAction {
|
|||||||
return new UpdateAction(false, false, false, null);
|
return new UpdateAction(false, false, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Replace() {
|
static Replace(params) {
|
||||||
return new UpdateAction(false, false, true, null);
|
return new UpdateAction(false, false, true, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ export class EncryptedEventTile extends MessageTile {
|
|||||||
const parentResult = super.updateEntry(entry, params);
|
const parentResult = super.updateEntry(entry, params);
|
||||||
// event got decrypted, recreate the tile and replace this one with it
|
// event got decrypted, recreate the tile and replace this one with it
|
||||||
if (entry.eventType !== "m.room.encrypted") {
|
if (entry.eventType !== "m.room.encrypted") {
|
||||||
return UpdateAction.Replace();
|
// the "shape" parameter trigger tile recreation in TimelineList
|
||||||
|
return UpdateAction.Replace("shape");
|
||||||
} else {
|
} else {
|
||||||
return parentResult;
|
return parentResult;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user