Don't preload /block APIs for genesis block

This commit is contained in:
nymkappa 2022-06-23 16:29:25 +02:00
parent 93dab57959
commit 53812c3751
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -155,13 +155,15 @@ export class BlockComponent implements OnInit, OnDestroy {
} }
}), }),
tap((block: BlockExtended) => { tap((block: BlockExtended) => {
// Preload previous block summary (execute the http query so the response will be cached) if (block.height > 0) {
this.unsubscribeNextBlockSubscriptions(); // Preload previous block summary (execute the http query so the response will be cached)
setTimeout(() => { this.unsubscribeNextBlockSubscriptions();
this.nextBlockSubscription = this.apiService.getBlock$(block.previousblockhash).subscribe(); setTimeout(() => {
this.nextBlockTxListSubscription = this.electrsApiService.getBlockTransactions$(block.previousblockhash).subscribe(); this.nextBlockSubscription = this.apiService.getBlock$(block.previousblockhash).subscribe();
this.nextBlockSummarySubscription = this.apiService.getStrippedBlockTransactions$(block.previousblockhash).subscribe(); this.nextBlockTxListSubscription = this.electrsApiService.getBlockTransactions$(block.previousblockhash).subscribe();
}, 100); this.nextBlockSummarySubscription = this.apiService.getStrippedBlockTransactions$(block.previousblockhash).subscribe();
}, 100);
}
this.block = block; this.block = block;
this.blockHeight = block.height; this.blockHeight = block.height;