From 53812c375139506064083d79d182a630da958d9c Mon Sep 17 00:00:00 2001 From: nymkappa Date: Thu, 23 Jun 2022 16:29:25 +0200 Subject: [PATCH] Don't preload /block APIs for genesis block --- .../src/app/components/block/block.component.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/components/block/block.component.ts b/frontend/src/app/components/block/block.component.ts index 3eb8c5bb0..1032998ef 100644 --- a/frontend/src/app/components/block/block.component.ts +++ b/frontend/src/app/components/block/block.component.ts @@ -155,13 +155,15 @@ export class BlockComponent implements OnInit, OnDestroy { } }), tap((block: BlockExtended) => { - // Preload previous block summary (execute the http query so the response will be cached) - this.unsubscribeNextBlockSubscriptions(); - setTimeout(() => { - this.nextBlockSubscription = this.apiService.getBlock$(block.previousblockhash).subscribe(); - this.nextBlockTxListSubscription = this.electrsApiService.getBlockTransactions$(block.previousblockhash).subscribe(); - this.nextBlockSummarySubscription = this.apiService.getStrippedBlockTransactions$(block.previousblockhash).subscribe(); - }, 100); + if (block.height > 0) { + // Preload previous block summary (execute the http query so the response will be cached) + this.unsubscribeNextBlockSubscriptions(); + setTimeout(() => { + this.nextBlockSubscription = this.apiService.getBlock$(block.previousblockhash).subscribe(); + this.nextBlockTxListSubscription = this.electrsApiService.getBlockTransactions$(block.previousblockhash).subscribe(); + this.nextBlockSummarySubscription = this.apiService.getStrippedBlockTransactions$(block.previousblockhash).subscribe(); + }, 100); + } this.block = block; this.blockHeight = block.height;