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 7cdb6e528f
commit 90d0fd1f89

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