Fix repeated new block animation on page navigation
This commit is contained in:
		
							parent
							
								
									951cf2daf9
								
							
						
					
					
						commit
						4be8016eb1
					
				@ -31,6 +31,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
 | 
			
		||||
  dynamicBlocksAmount: number = 8;
 | 
			
		||||
  emptyBlocks: BlockExtended[] = this.mountEmptyBlocks();
 | 
			
		||||
  markHeight: number;
 | 
			
		||||
  chainTip: number;
 | 
			
		||||
  blocksSubscription: Subscription;
 | 
			
		||||
  blockPageSubscription: Subscription;
 | 
			
		||||
  networkSubscription: Subscription;
 | 
			
		||||
@ -73,6 +74,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit() {
 | 
			
		||||
    this.chainTip = this.stateService.latestBlockHeight;
 | 
			
		||||
    this.dynamicBlocksAmount = Math.min(8, this.stateService.env.KEEP_BLOCKS_AMOUNT);
 | 
			
		||||
 | 
			
		||||
    if (['', 'testnet', 'signet'].includes(this.stateService.network)) {
 | 
			
		||||
@ -115,7 +117,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          this.blockStyles = [];
 | 
			
		||||
          if (this.blocksFilled) {
 | 
			
		||||
          if (this.blocksFilled && block.height > this.chainTip) {
 | 
			
		||||
            this.blocks.forEach((b, i) => this.blockStyles.push(this.getStyleForBlock(b, i, i ? -155 : -205)));
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
              this.blockStyles = [];
 | 
			
		||||
@ -129,6 +131,8 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
 | 
			
		||||
          if (this.blocks.length === this.dynamicBlocksAmount) {
 | 
			
		||||
            this.blocksFilled = true;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          this.chainTip = Math.max(this.chainTip, block.height);
 | 
			
		||||
          this.cd.markForCheck();
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user