Merge pull request #3297 from mempool/nymkappa/duplicate-block
Fixes duplicate block in latest block component
This commit is contained in:
		
						commit
						25c7c84705
					
				@ -87,8 +87,8 @@ export class BlocksList implements OnInit, OnDestroy {
 | 
				
			|||||||
      this.stateService.blocks$
 | 
					      this.stateService.blocks$
 | 
				
			||||||
        .pipe(
 | 
					        .pipe(
 | 
				
			||||||
          switchMap((block) => {
 | 
					          switchMap((block) => {
 | 
				
			||||||
            if (block[0].height < this.lastBlockHeight) {
 | 
					            if (block[0].height <= this.lastBlockHeight) {
 | 
				
			||||||
              return []; // Return an empty stream so the last pipe is not executed
 | 
					              return [null]; // Return an empty stream so the last pipe is not executed
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            this.lastBlockHeight = block[0].height;
 | 
					            this.lastBlockHeight = block[0].height;
 | 
				
			||||||
            return [block];
 | 
					            return [block];
 | 
				
			||||||
@ -101,6 +101,7 @@ export class BlocksList implements OnInit, OnDestroy {
 | 
				
			|||||||
            this.lastPage = this.page;
 | 
					            this.lastPage = this.page;
 | 
				
			||||||
            return blocks[0];
 | 
					            return blocks[0];
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          if (blocks[1]) {
 | 
				
			||||||
            this.blocksCount = Math.max(this.blocksCount, blocks[1][0].height) + 1;
 | 
					            this.blocksCount = Math.max(this.blocksCount, blocks[1][0].height) + 1;
 | 
				
			||||||
            if (this.stateService.env.MINING_DASHBOARD) {
 | 
					            if (this.stateService.env.MINING_DASHBOARD) {
 | 
				
			||||||
              // @ts-ignore: Need to add an extra field for the template
 | 
					              // @ts-ignore: Need to add an extra field for the template
 | 
				
			||||||
@ -109,6 +110,7 @@ export class BlocksList implements OnInit, OnDestroy {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            acc.unshift(blocks[1][0]);
 | 
					            acc.unshift(blocks[1][0]);
 | 
				
			||||||
            acc = acc.slice(0, this.widget ? 6 : 15);
 | 
					            acc = acc.slice(0, this.widget ? 6 : 15);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
          return acc;
 | 
					          return acc;
 | 
				
			||||||
        }, [])
 | 
					        }, [])
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user