diff --git a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts index 487659896..8fa6ceb75 100644 --- a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts +++ b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts @@ -35,8 +35,9 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy { ngOnInit() { this.mempoolBlocksSubscription = this.stateService.mempoolBlocks$ .subscribe((blocks) => { - this.mempoolBlocksFull = JSON.parse(JSON.stringify(blocks)); - this.mempoolBlocks = this.reduceMempoolBlocksToFitScreen(blocks); + const stringifiedBlocks = JSON.stringify(blocks); + this.mempoolBlocksFull = JSON.parse(stringifiedBlocks); + this.mempoolBlocks = this.reduceMempoolBlocksToFitScreen(JSON.parse(stringifiedBlocks)); this.calculateTransactionPosition(); }); diff --git a/frontend/src/app/components/time-since/time-since.component.ts b/frontend/src/app/components/time-since/time-since.component.ts index 0b89e52cc..62ba9009e 100644 --- a/frontend/src/app/components/time-since/time-since.component.ts +++ b/frontend/src/app/components/time-since/time-since.component.ts @@ -1,11 +1,11 @@ -import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, Input, ChangeDetectorRef } from '@angular/core'; +import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, Input, ChangeDetectorRef, OnChanges } from '@angular/core'; @Component({ selector: 'app-time-since', template: `{{ text }}`, changeDetection: ChangeDetectionStrategy.OnPush }) -export class TimeSinceComponent implements OnInit, OnDestroy { +export class TimeSinceComponent implements OnInit, OnChanges, OnDestroy { interval: number; text: string; @@ -17,13 +17,17 @@ export class TimeSinceComponent implements OnInit, OnDestroy { ) { } ngOnInit() { - this.text = this.calculate(); this.interval = window.setInterval(() => { this.text = this.calculate(); this.ref.markForCheck(); }, 1000 * (this.fastRender ? 1 : 60)); } + ngOnChanges() { + this.text = this.calculate(); + this.ref.markForCheck(); + } + ngOnDestroy() { clearInterval(this.interval); }