From 3f80dbc5ce45eda7f59fdb03582623a60305c40a Mon Sep 17 00:00:00 2001 From: natsoni Date: Mon, 1 Apr 2024 18:00:10 +0900 Subject: [PATCH] Fix random console errors on block loading --- .../src/app/components/block/block.component.html | 14 +++++++------- .../src/app/components/block/block.component.ts | 6 +++--- .../transactions-list.component.ts | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/components/block/block.component.html b/frontend/src/app/components/block/block.component.html index 0c0655c01..282863fab 100644 --- a/frontend/src/app/components/block/block.component.html +++ b/frontend/src/app/components/block/block.component.html @@ -39,7 +39,7 @@
- + @@ -126,16 +126,16 @@ - + - + - + -
Hash {{ block.id | shortenString : 13 }}
Fee span - -
Median fee~ + ~ - @@ -259,7 +259,7 @@ - +

diff --git a/frontend/src/app/components/block/block.component.ts b/frontend/src/app/components/block/block.component.ts index 2602c5ecd..9c812c6f0 100644 --- a/frontend/src/app/components/block/block.component.ts +++ b/frontend/src/app/components/block/block.component.ts @@ -460,9 +460,9 @@ export class BlockComponent implements OnInit, OnDestroy { inBlock[tx.txid] = true; } - blockAudit.feeDelta = blockAudit.expectedFees > 0 ? (blockAudit.expectedFees - (this.block.extras.totalFees + this.oobFees)) / blockAudit.expectedFees : 0; - blockAudit.weightDelta = blockAudit.expectedWeight > 0 ? (blockAudit.expectedWeight - this.block.weight) / blockAudit.expectedWeight : 0; - blockAudit.txDelta = blockAudit.template.length > 0 ? (blockAudit.template.length - this.block.tx_count) / blockAudit.template.length : 0; + blockAudit.feeDelta = blockAudit.expectedFees > 0 ? (blockAudit.expectedFees - (this.block?.extras.totalFees + this.oobFees)) / blockAudit.expectedFees : 0; + blockAudit.weightDelta = blockAudit.expectedWeight > 0 ? (blockAudit.expectedWeight - this.block?.weight) / blockAudit.expectedWeight : 0; + blockAudit.txDelta = blockAudit.template.length > 0 ? (blockAudit.template.length - this.block?.tx_count) / blockAudit.template.length : 0; this.blockAudit = blockAudit; this.setAuditAvailable(true); } else { diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index 8f91489c1..b66889f0b 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -154,7 +154,7 @@ export class TransactionsListComponent implements OnInit, OnChanges { }); } else { this.priceService.getBlockPrice$(this.blockTime, true, this.currency).pipe( - tap((price) => this.transactions.forEach((tx) => tx['price'] = price)), + tap((price) => this.transactions?.forEach((tx) => tx['price'] = price)), ).subscribe(); } } @@ -239,7 +239,7 @@ export class TransactionsListComponent implements OnInit, OnChanges { if (this.blockTime && this.transactions?.length && this.currency) { this.priceService.getBlockPrice$(this.blockTime, true, this.currency).pipe( - tap((price) => this.transactions.forEach((tx) => tx['price'] = price)), + tap((price) => this.transactions?.forEach((tx) => tx['price'] = price)), ).subscribe(); } const txIds = this.transactions.filter((tx) => !tx._outspends).map((tx) => tx.txid);