fix error when navigating to huge transactions

This commit is contained in:
Mononaut
2022-11-07 20:05:33 -06:00
parent 18142538f8
commit 8715e5ab91
6 changed files with 27 additions and 7 deletions

View File

@@ -112,6 +112,8 @@ export class StateService {
timeLtr: BehaviorSubject<boolean>;
hideFlow: BehaviorSubject<boolean>;
txCache: { [txid: string]: Transaction } = {};
constructor(
@Inject(PLATFORM_ID) private platformId: any,
@Inject(LOCALE_ID) private locale: string,
@@ -265,4 +267,19 @@ export class StateService {
isLiquid() {
return this.network === 'liquid' || this.network === 'liquidtestnet';
}
setTxCache(transactions) {
this.txCache = {};
transactions.forEach(tx => {
this.txCache[tx.txid] = tx;
});
}
getTxFromCache(txid) {
if (this.txCache && this.txCache[txid]) {
return this.txCache[txid];
} else {
return null;
}
}
}