From cfc06be97595cb264bb7333360c8c43366b8dc22 Mon Sep 17 00:00:00 2001 From: natsoni Date: Tue, 9 Apr 2024 14:11:57 +0900 Subject: [PATCH] Fix subscription management in address component --- .../src/app/components/address/address.component.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/address/address.component.ts b/frontend/src/app/components/address/address.component.ts index 614be930c..95abe4ac1 100644 --- a/frontend/src/app/components/address/address.component.ts +++ b/frontend/src/app/components/address/address.component.ts @@ -28,6 +28,9 @@ export class AddressComponent implements OnInit, OnDestroy { retryLoadMore = false; error: any; mainSubscription: Subscription; + mempoolTxSubscription: Subscription; + mempoolRemovedTxSubscription: Subscription; + blockTxSubscription: Subscription; addressLoadingStatus$: Observable; addressInfo: null | AddressInformation = null; @@ -179,17 +182,17 @@ export class AddressComponent implements OnInit, OnDestroy { this.isLoadingAddress = false; }); - this.stateService.mempoolTransactions$ + this.mempoolTxSubscription = this.stateService.mempoolTransactions$ .subscribe(tx => { this.addTransaction(tx); }); - this.stateService.mempoolRemovedTransactions$ + this.mempoolRemovedTxSubscription = this.stateService.mempoolRemovedTransactions$ .subscribe(tx => { this.removeTransaction(tx); }); - this.stateService.blockTransactions$ + this.blockTxSubscription = this.stateService.blockTransactions$ .subscribe((transaction) => { const tx = this.transactions.find((t) => t.txid === transaction.txid); if (tx) { @@ -295,6 +298,9 @@ export class AddressComponent implements OnInit, OnDestroy { ngOnDestroy() { this.mainSubscription.unsubscribe(); + this.mempoolTxSubscription.unsubscribe(); + this.mempoolRemovedTxSubscription.unsubscribe(); + this.blockTxSubscription.unsubscribe(); this.websocketService.stopTrackingAddress(); } }