-
+
Details
diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts
index 4fedc3912..d41ba4b63 100644
--- a/frontend/src/app/components/transaction/transaction.component.ts
+++ b/frontend/src/app/components/transaction/transaction.component.ts
@@ -57,6 +57,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
fetchCpfp$ = new Subject();
fetchRbfHistory$ = new Subject();
fetchCachedTx$ = new Subject();
+ isCached: boolean = false;
now = new Date().getTime();
timeAvg$: Observable;
liquidUnblinding = new LiquidUnblinding();
@@ -196,6 +197,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.tx = tx;
+ this.isCached = true;
if (tx.fee === undefined) {
this.tx.fee = 0;
}
@@ -289,6 +291,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.tx = tx;
+ this.isCached = false;
if (tx.fee === undefined) {
this.tx.fee = 0;
}
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 c720d5960..afda646d7 100644
--- a/frontend/src/app/components/transactions-list/transactions-list.component.ts
+++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts
@@ -1,7 +1,7 @@
import { Component, OnInit, Input, ChangeDetectionStrategy, OnChanges, Output, EventEmitter, ChangeDetectorRef } from '@angular/core';
import { StateService } from '../../services/state.service';
import { CacheService } from '../../services/cache.service';
-import { Observable, ReplaySubject, BehaviorSubject, merge, Subscription } from 'rxjs';
+import { Observable, ReplaySubject, BehaviorSubject, merge, Subscription, of } from 'rxjs';
import { Outspend, Transaction, Vin, Vout } from '../../interfaces/electrs.interface';
import { ElectrsApiService } from '../../services/electrs-api.service';
import { environment } from '../../../environments/environment';
@@ -23,6 +23,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
showMoreIncrement = 1000;
@Input() transactions: Transaction[];
+ @Input() cached: boolean = false;
@Input() showConfirmations = false;
@Input() transactionPage = false;
@Input() errorUnblinded = false;
@@ -67,7 +68,13 @@ export class TransactionsListComponent implements OnInit, OnChanges {
this.outspendsSubscription = merge(
this.refreshOutspends$
.pipe(
- switchMap((txIds) => this.apiService.getOutspendsBatched$(txIds)),
+ switchMap((txIds) => {
+ if (!this.cached) {
+ return this.apiService.getOutspendsBatched$(txIds);
+ } else {
+ return of([]);
+ }
+ }),
tap((outspends: Outspend[][]) => {
if (!this.transactions) {
return;
@@ -155,7 +162,7 @@ export class TransactionsListComponent implements OnInit, OnChanges {
).subscribe();
});
const txIds = this.transactions.filter((tx) => !tx._outspends).map((tx) => tx.txid);
- if (txIds.length) {
+ if (txIds.length && !this.cached) {
this.refreshOutspends$.next(txIds);
}
if (this.stateService.env.LIGHTNING) {
diff --git a/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts b/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts
index 6be475243..1c5ee5391 100644
--- a/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts
+++ b/frontend/src/app/components/tx-bowtie-graph/tx-bowtie-graph.component.ts
@@ -2,7 +2,7 @@ import { Component, OnInit, Input, OnChanges, HostListener, Inject, LOCALE_ID }
import { StateService } from '../../services/state.service';
import { Outspend, Transaction } from '../../interfaces/electrs.interface';
import { Router } from '@angular/router';
-import { ReplaySubject, merge, Subscription } from 'rxjs';
+import { ReplaySubject, merge, Subscription, of } from 'rxjs';
import { tap, switchMap } from 'rxjs/operators';
import { ApiService } from '../../services/api.service';
import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pipe';
@@ -40,6 +40,7 @@ interface Xput {
export class TxBowtieGraphComponent implements OnInit, OnChanges {
@Input() tx: Transaction;
@Input() network: string;
+ @Input() cached: boolean = false;
@Input() width = 1200;
@Input() height = 600;
@Input() lineLimit = 250;
@@ -107,7 +108,13 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges {
this.outspendsSubscription = merge(
this.refreshOutspends$
.pipe(
- switchMap((txid) => this.apiService.getOutspendsBatched$([txid])),
+ switchMap((txid) => {
+ if (!this.cached) {
+ return this.apiService.getOutspendsBatched$([txid]);
+ } else {
+ return of(null);
+ }
+ }),
tap((outspends: Outspend[][]) => {
if (!this.tx || !outspends || !outspends.length) {
return;
@@ -132,7 +139,9 @@ export class TxBowtieGraphComponent implements OnInit, OnChanges {
ngOnChanges(): void {
this.initGraph();
- this.refreshOutspends$.next(this.tx.txid);
+ if (!this.cached) {
+ this.refreshOutspends$.next(this.tx.txid);
+ }
}
initGraph(): void {