From 778e2f9b6464a5bd5e80e0f7bd193e29fc0ca3ad Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Fri, 10 Mar 2023 10:26:30 +0900 Subject: [PATCH] Fixes #3217 --- .../blocks-list/blocks-list.component.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.ts b/frontend/src/app/components/blocks-list/blocks-list.component.ts index 160e0c882..0086ff902 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.ts +++ b/frontend/src/app/components/blocks-list/blocks-list.component.ts @@ -87,8 +87,8 @@ export class BlocksList implements OnInit, OnDestroy { this.stateService.blocks$ .pipe( switchMap((block) => { - if (block[0].height < this.lastBlockHeight) { - return []; // Return an empty stream so the last pipe is not executed + if (block[0].height <= this.lastBlockHeight) { + return [null]; // Return an empty stream so the last pipe is not executed } this.lastBlockHeight = block[0].height; return [block]; @@ -101,14 +101,16 @@ export class BlocksList implements OnInit, OnDestroy { this.lastPage = this.page; return blocks[0]; } - this.blocksCount = Math.max(this.blocksCount, blocks[1][0].height) + 1; - if (this.stateService.env.MINING_DASHBOARD) { - // @ts-ignore: Need to add an extra field for the template - blocks[1][0].extras.pool.logo = `/resources/mining-pools/` + - blocks[1][0].extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg'; + if (blocks[1]) { + this.blocksCount = Math.max(this.blocksCount, blocks[1][0].height) + 1; + if (this.stateService.env.MINING_DASHBOARD) { + // @ts-ignore: Need to add an extra field for the template + blocks[1][0].extras.pool.logo = `/resources/mining-pools/` + + blocks[1][0].extras.pool.name.toLowerCase().replace(' ', '').replace('.', '') + '.svg'; + } + acc.unshift(blocks[1][0]); + acc = acc.slice(0, this.widget ? 6 : 15); } - acc.unshift(blocks[1][0]); - acc = acc.slice(0, this.widget ? 6 : 15); return acc; }, []) );