Remove duplicated ChangeDetectorRef in blockchains blocks component

This commit is contained in:
nymkappa 2022-02-18 22:25:31 +09:00
parent fb2c0345a7
commit 008a4b51cc
No known key found for this signature in database
GPG key ID: E155910B16E8BD04
2 changed files with 5 additions and 6 deletions

View file

@ -21,10 +21,10 @@
</div> </div>
<div class="time-difference"><app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since></div> <div class="time-difference"><app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since></div>
</div> </div>
<div class="animated" [class]="showMiningInfo ? 'show' : 'hide'" *ngIf="block.extras?.pool != undefined"> <div class="animated" [class]="showMiningInfo ? 'show' : 'hide'" *ngIf="block.extras?.pool != undefined">
<a class="badge badge-primary" [routerLink]="[('/mining/pool/' + block.extras.pool.id) | relativeUrl]"> <a class="badge badge-primary" [routerLink]="[('/mining/pool/' + block.extras.pool.id) | relativeUrl]">
{{ block.extras.pool.name}}</a> {{ block.extras.pool.name}}</a>
</div> </div>
</div> </div>
</div> </div>
<div [hidden]="!arrowVisible" id="arrow-up" [style.transition]="transition" [ngStyle]="{'left': arrowLeftPx + 'px' }"></div> <div [hidden]="!arrowVisible" id="arrow-up" [style.transition]="transition" [ngStyle]="{'left': arrowLeftPx + 'px' }"></div>

View file

@ -47,13 +47,12 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
public stateService: StateService, public stateService: StateService,
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
private location: Location, private location: Location,
private cdr: ChangeDetectorRef
) { ) {
} }
enabledMiningInfoIfNeeded(url) { enabledMiningInfoIfNeeded(url) {
this.showMiningInfo = url === '/mining'; this.showMiningInfo = url === '/mining';
this.cdr.detectChanges(); // Need to update the view asap this.cd.markForCheck(); // Need to update the view asap
} }
ngOnInit() { ngOnInit() {