mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-23 02:31: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);
|
this.emitRemove(tileIdx, tile);
|
||||||
prevTile?.updateNextSibling(nextTile);
|
prevTile?.updateNextSibling(nextTile);
|
||||||
nextTile?.updatePreviousSibling(prevTile);
|
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
|
// 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
|
// let item know it has a new sibling
|
||||||
updateNextSibling(next: ITile<BaseEntry> | undefined): UpdateAction {
|
updateNextSibling(next: ITile<BaseEntry> | undefined): UpdateAction {
|
||||||
// TODO: next can be undefined when a pending event is removed
|
if(!next) {
|
||||||
// TODO: we need a way to remove this date header
|
// If we are the DateTile for the last tile in the timeline,
|
||||||
this._firstTileInDay = next!;
|
// 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;
|
const prevDateString = this._dateString;
|
||||||
this._dateString = undefined;
|
this._dateString = undefined;
|
||||||
if (prevDateString && prevDateString !== this.date) {
|
if (prevDateString && prevDateString !== this.date) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user