also always update siblings when adding an entry,even when there is none

otherwise the first item in the list won't have a date separator
This commit is contained in:
Bruno Windels 2022-06-25 12:48:14 +02:00
parent 49752a0e7c
commit a488ff143e

View file

@ -130,15 +130,11 @@ export class TilesCollection extends BaseObservableList {
const newTile = this._createTile(entry);
if (newTile) {
if (prevTile) {
prevTile.updateNextSibling(newTile);
// this emits an update while the add hasn't been emitted yet
newTile.updatePreviousSibling(prevTile);
}
if (nextTile) {
newTile.updateNextSibling(nextTile);
nextTile.updatePreviousSibling(newTile);
}
prevTile?.updateNextSibling(newTile);
// this emits an update while the add hasn't been emitted yet
newTile.updatePreviousSibling(prevTile);
newTile.updateNextSibling(nextTile);
nextTile?.updatePreviousSibling(newTile);
this._tiles.splice(tileIdx, 0, newTile);
this.emitAdd(tileIdx, newTile);
// add event is emitted, now the tile