remove lower bound check as we don't go negative anymore

This commit is contained in:
Bruno Windels 2022-11-25 11:51:38 +01:00
parent 31f53d27c1
commit cb0ab589de

View File

@ -157,9 +157,6 @@ export class TilesCollection extends BaseObservableList {
// next next tile // next next tile
for (let i = 0; i < 2; i += 1) { for (let i = 0; i < 2; i += 1) {
const idx = tileIdx + i; const idx = tileIdx + i;
if (idx < 0) {
continue;
}
if (idx >= this._tiles.length) { if (idx >= this._tiles.length) {
break; break;
} }
@ -167,11 +164,11 @@ export class TilesCollection extends BaseObservableList {
const prevTile = idx > 0 ? this._tiles[idx - 1] : undefined; const prevTile = idx > 0 ? this._tiles[idx - 1] : undefined;
const hasDateSeparator = prevTile?.shape === TileShape.DateHeader; const hasDateSeparator = prevTile?.shape === TileShape.DateHeader;
if (tile.needsDateSeparator && !hasDateSeparator) { if (tile.needsDateSeparator && !hasDateSeparator) {
// adding a tile shift all the indices we need to consider // adding a tile shift all the indices we need to consider
// especially given we consider removals for the tile that // especially given we consider removals for the tile that
// comes after a datetile // comes after a datetile
tileIdx += 1; tileIdx += 1;
this._addTileAt(idx, tile.createDateSeparator()); this._addTileAt(idx, tile.createDateSeparator());
} else if (!tile.needsDateSeparator && hasDateSeparator) { } else if (!tile.needsDateSeparator && hasDateSeparator) {
// this is never triggered because needsDateSeparator is not cleared // this is never triggered because needsDateSeparator is not cleared
// when loading more items because we don't do anything once the // when loading more items because we don't do anything once the