mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-02-02 07:31:38 +01:00
bound checks in date header loop and cleanup
Co-authored-by: R Midhun Suresh <MidhunSureshR@users.noreply.github.com>
This commit is contained in:
parent
3f7c1577e0
commit
d889c7deeb
@ -154,8 +154,14 @@ export class TilesCollection extends BaseObservableList {
|
|||||||
//console.log("_evaluateDateHeaderAtIdx", tileIdx);
|
//console.log("_evaluateDateHeaderAtIdx", tileIdx);
|
||||||
// consider the two adjacent tiles where the previous sibling changed:
|
// consider the two adjacent tiles where the previous sibling changed:
|
||||||
// the new tile and the next tile
|
// the new tile and the next tile
|
||||||
for (let i = 0; i < 5; i += 1) {
|
for (let i = -2; i < 3; i += 1) {
|
||||||
const idx = Math.max(tileIdx + i - 2, 0);
|
const idx = tileIdx + i;
|
||||||
|
if (idx < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (idx >= this._tiles.length) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
const tile = this._tiles[idx];
|
const tile = this._tiles[idx];
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user