Fix missing mempool blocks bug
This commit is contained in:
parent
31e320b2e2
commit
3178d30f2a
@ -1,7 +1,7 @@
|
|||||||
<ng-container *ngIf="(loadingBlocks$ | async) === false; else loadingBlocks" [class.minimal]="minimal">
|
<ng-container *ngIf="(loadingBlocks$ | async) === false; else loadingBlocks" [class.minimal]="minimal">
|
||||||
<div class="mempool-blocks-container" [class.time-ltr]="timeLtr" [style.--block-size]="blockWidth+'px'" *ngIf="(difficultyAdjustments$ | async) as da;">
|
<div class="mempool-blocks-container" [class.time-ltr]="timeLtr" [style.--block-size]="blockWidth+'px'" *ngIf="(difficultyAdjustments$ | async) as da;">
|
||||||
<div class="flashing">
|
<div class="flashing" *ngIf="(mempoolBlocks$ | async) as mempoolBlocks">
|
||||||
<ng-template ngFor let-projectedBlock [ngForOf]="mempoolBlocks$ | async" let-i="index" [ngForTrackBy]="trackByFn">
|
<ng-template ngFor let-projectedBlock [ngForOf]="mempoolBlocks" let-i="index" [ngForTrackBy]="trackByFn">
|
||||||
<div
|
<div
|
||||||
*ngIf="minimal && spotlight > 0 && spotlight === i + 1"
|
*ngIf="minimal && spotlight > 0 && spotlight === i + 1"
|
||||||
class="spotlight-bottom"
|
class="spotlight-bottom"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef, HostListener, Input, OnChanges, SimpleChanges, Output, EventEmitter } from '@angular/core';
|
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef, HostListener, Input, OnChanges, SimpleChanges, Output, EventEmitter } from '@angular/core';
|
||||||
import { Subscription, Observable, fromEvent, merge, of, combineLatest } from 'rxjs';
|
import { Subscription, Observable, of, combineLatest } from 'rxjs';
|
||||||
import { MempoolBlock } from '../../interfaces/websocket.interface';
|
import { MempoolBlock } from '../../interfaces/websocket.interface';
|
||||||
import { StateService } from '../../services/state.service';
|
import { StateService } from '../../services/state.service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { take, map, switchMap, tap } from 'rxjs/operators';
|
import { map, switchMap, tap } from 'rxjs/operators';
|
||||||
import { feeLevels, mempoolFeeColors } from '../../app.constants';
|
import { feeLevels, mempoolFeeColors } from '../../app.constants';
|
||||||
import { specialBlocks } from '../../app.constants';
|
import { specialBlocks } from '../../app.constants';
|
||||||
import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pipe';
|
import { RelativeUrlPipe } from '../../shared/pipes/relative-url/relative-url.pipe';
|
||||||
@ -86,7 +86,7 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
public stateService: StateService,
|
public stateService: StateService,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private relativeUrlPipe: RelativeUrlPipe,
|
private relativeUrlPipe: RelativeUrlPipe,
|
||||||
private location: Location
|
private location: Location,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
enabledMiningInfoIfNeeded(url) {
|
enabledMiningInfoIfNeeded(url) {
|
||||||
@ -129,12 +129,7 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.mempoolBlocks$ = merge(
|
this.mempoolBlocks$ = combineLatest([
|
||||||
of(true),
|
|
||||||
fromEvent(window, 'resize')
|
|
||||||
)
|
|
||||||
.pipe(
|
|
||||||
switchMap(() => combineLatest([
|
|
||||||
this.stateService.blocks$.pipe(map((blocks) => blocks[0])),
|
this.stateService.blocks$.pipe(map((blocks) => blocks[0])),
|
||||||
this.stateService.mempoolBlocks$
|
this.stateService.mempoolBlocks$
|
||||||
.pipe(
|
.pipe(
|
||||||
@ -145,7 +140,7 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
return mempoolBlocks;
|
return mempoolBlocks;
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
])),
|
]).pipe(
|
||||||
map(([lastBlock, mempoolBlocks]) => {
|
map(([lastBlock, mempoolBlocks]) => {
|
||||||
mempoolBlocks.forEach((block, i) => {
|
mempoolBlocks.forEach((block, i) => {
|
||||||
block.index = this.blockIndex + i;
|
block.index = this.blockIndex + i;
|
||||||
@ -169,7 +164,6 @@ export class MempoolBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
if (this.mempoolWidth !== width) {
|
if (this.mempoolWidth !== width) {
|
||||||
this.mempoolWidth = width;
|
this.mempoolWidth = width;
|
||||||
this.widthChange.emit(this.mempoolWidth);
|
this.widthChange.emit(this.mempoolWidth);
|
||||||
this.cd.markForCheck();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user