add missing markForChecks in blocks list

This commit is contained in:
Mononaut 2023-06-14 16:15:58 -04:00
parent c4f7b99978
commit 30f8d5cf96
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, Input } from '@angular/core'; import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, Input, ChangeDetectorRef } from '@angular/core';
import { BehaviorSubject, combineLatest, concat, Observable, timer, EMPTY, Subscription, of } from 'rxjs'; import { BehaviorSubject, combineLatest, concat, Observable, timer, EMPTY, Subscription, of } from 'rxjs';
import { catchError, delayWhen, map, retryWhen, scan, skip, switchMap, tap } from 'rxjs/operators'; import { catchError, delayWhen, map, retryWhen, scan, skip, switchMap, tap } from 'rxjs/operators';
import { BlockExtended } from '../../interfaces/node-api.interface'; import { BlockExtended } from '../../interfaces/node-api.interface';
@ -39,6 +39,7 @@ export class BlocksList implements OnInit, OnDestroy {
private apiService: ApiService, private apiService: ApiService,
private websocketService: WebsocketService, private websocketService: WebsocketService,
public stateService: StateService, public stateService: StateService,
private cd: ChangeDetectorRef,
) { ) {
} }
@ -114,7 +115,6 @@ export class BlocksList implements OnInit, OnDestroy {
return acc; return acc;
}, []), }, []),
switchMap((blocks) => { switchMap((blocks) => {
console.log(blocks);
blocks.forEach(block => { blocks.forEach(block => {
block.extras.feeDelta = block.extras.expectedFees ? (block.extras.totalFees - block.extras.expectedFees) / block.extras.expectedFees : 0; block.extras.feeDelta = block.extras.expectedFees ? (block.extras.totalFees - block.extras.expectedFees) / block.extras.expectedFees : 0;
}); });
@ -138,6 +138,7 @@ export class BlocksList implements OnInit, OnDestroy {
this.auditScores[score.hash] = score?.matchRate != null ? score.matchRate : null; this.auditScores[score.hash] = score?.matchRate != null ? score.matchRate : null;
}); });
this.loadingScores = false; this.loadingScores = false;
this.cd.markForCheck();
}); });
this.latestScoreSubscription = this.stateService.blocks$.pipe( this.latestScoreSubscription = this.stateService.blocks$.pipe(
@ -162,6 +163,7 @@ export class BlocksList implements OnInit, OnDestroy {
).subscribe((score) => { ).subscribe((score) => {
if (score && score.hash) { if (score && score.hash) {
this.auditScores[score.hash] = score?.matchRate != null ? score.matchRate : null; this.auditScores[score.hash] = score?.matchRate != null ? score.matchRate : null;
this.cd.markForCheck();
} }
}); });
} }