mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-22 18:21:39 +01:00
remove date headers when removing pending tiles
This commit is contained in:
parent
cb0ab589de
commit
7c6d651b32
@ -255,6 +255,10 @@ export class TilesCollection extends BaseObservableList {
|
||||
this.emitRemove(tileIdx, tile);
|
||||
prevTile?.updateNextSibling(nextTile);
|
||||
nextTile?.updatePreviousSibling(prevTile);
|
||||
|
||||
if (prevTile && prevTile.shape === TileShape.DateHeader && (!nextTile || !nextTile.needsDateSeparator)) {
|
||||
this._removeTile(tileIdx - 1, prevTile);
|
||||
}
|
||||
}
|
||||
|
||||
// would also be called when unloading a part of the timeline
|
||||
|
@ -127,9 +127,14 @@ export class DateTile extends ViewModel implements ITile<BaseEventEntry> {
|
||||
|
||||
// let item know it has a new sibling
|
||||
updateNextSibling(next: ITile<BaseEntry> | undefined): UpdateAction {
|
||||
// TODO: next can be undefined when a pending event is removed
|
||||
// TODO: we need a way to remove this date header
|
||||
this._firstTileInDay = next!;
|
||||
if(!next) {
|
||||
// If we are the DateTile for the last tile in the timeline,
|
||||
// and that tile gets removed, next would be undefined
|
||||
// and this DateTile would be removed as well,
|
||||
// so do nothing
|
||||
return;
|
||||
}
|
||||
this._firstTileInDay = next;
|
||||
const prevDateString = this._dateString;
|
||||
this._dateString = undefined;
|
||||
if (prevDateString && prevDateString !== this.date) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user