diff --git a/frontend/src/app/components/address-graph/address-graph.component.ts b/frontend/src/app/components/address-graph/address-graph.component.ts index a5db9602d..842e96cdd 100644 --- a/frontend/src/app/components/address-graph/address-graph.component.ts +++ b/frontend/src/app/components/address-graph/address-graph.component.ts @@ -73,7 +73,7 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { if (!this.address || !this.stats) { return; } - if (changes.address || changes.isPubkey || changes.addressSummary$) { + if (changes.address || changes.isPubkey || changes.addressSummary$ || changes.stats) { if (this.subscription) { this.subscription.unsubscribe(); } @@ -248,7 +248,9 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { } ngOnDestroy(): void { - this.subscription.unsubscribe(); + if (this.subscription) { + this.subscription.unsubscribe(); + } } isMobile() { diff --git a/frontend/src/app/components/custom-dashboard/custom-dashboard.component.html b/frontend/src/app/components/custom-dashboard/custom-dashboard.component.html index 9180571a0..ddf8d1d3d 100644 --- a/frontend/src/app/components/custom-dashboard/custom-dashboard.component.html +++ b/frontend/src/app/components/custom-dashboard/custom-dashboard.component.html @@ -238,7 +238,7 @@   - + diff --git a/frontend/src/app/components/custom-dashboard/custom-dashboard.component.ts b/frontend/src/app/components/custom-dashboard/custom-dashboard.component.ts index 2847b6586..e64151323 100644 --- a/frontend/src/app/components/custom-dashboard/custom-dashboard.component.ts +++ b/frontend/src/app/components/custom-dashboard/custom-dashboard.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, ChangeDetectionStrategy, Component, HostListener, Inject, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core'; +import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, HostListener, Inject, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core'; import { combineLatest, merge, Observable, of, Subject, Subscription } from 'rxjs'; import { catchError, filter, map, scan, share, shareReplay, startWith, switchMap, tap } from 'rxjs/operators'; import { BlockExtended, OptimizedMempoolStats, TransactionStripped } from '../../interfaces/node-api.interface'; @@ -85,6 +85,7 @@ export class CustomDashboardComponent implements OnInit, OnDestroy, AfterViewIni private electrsApiService: ElectrsApiService, private websocketService: WebsocketService, private seoService: SeoService, + private cd: ChangeDetectorRef, @Inject(PLATFORM_ID) private platformId: Object, ) { this.webGlEnabled = this.stateService.isBrowser && detectWebGL(); @@ -283,8 +284,8 @@ export class CustomDashboardComponent implements OnInit, OnDestroy, AfterViewIni startAddressSubscription(): void { if (this.stateService.env.customize && this.stateService.env.customize.dashboard.widgets.some(w => w.props?.address)) { - const address = this.stateService.env.customize.dashboard.widgets.find(w => w.props?.address).props.address; - const addressString = (/^[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100}|04[a-fA-F0-9]{128}|(02|03)[a-fA-F0-9]{64}$/.test(address)) ? address.toLowerCase() : address; + let addressString = this.stateService.env.customize.dashboard.widgets.find(w => w.props?.address).props.address; + addressString = (/^[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100}|04[a-fA-F0-9]{128}|(02|03)[a-fA-F0-9]{64}$/.test(addressString)) ? addressString.toLowerCase() : addressString; this.addressSubscription = ( addressString.match(/04[a-fA-F0-9]{128}|(02|03)[a-fA-F0-9]{64}/) @@ -299,6 +300,7 @@ export class CustomDashboardComponent implements OnInit, OnDestroy, AfterViewIni ).subscribe((address: Address) => { this.websocketService.startTrackAddress(address.address); this.address = address; + this.cd.markForCheck(); }); this.addressSummary$ = (