fix block height out of range on full page blocks viewer

This commit is contained in:
Antoni Spaanderman 2022-01-24 20:26:02 +01:00
parent afcb1985ca
commit 07477957fd

View File

@ -109,8 +109,12 @@ export class LatestBlocksComponent implements OnInit, OnDestroy {
if (this.isLoading) { if (this.isLoading) {
return; return;
} }
const height = this.blocks[this.blocks.length - 1].height - 1;
if (height < 0) {
return;
}
this.isLoading = true; this.isLoading = true;
this.electrsApiService.listBlocks$(this.blocks[this.blocks.length - 1].height - 1) this.electrsApiService.listBlocks$(height)
.subscribe((blocks) => { .subscribe((blocks) => {
this.blocks = this.blocks.concat(blocks); this.blocks = this.blocks.concat(blocks);
this.isLoading = false; this.isLoading = false;