Fix rendering issue when clicking on block link from pool page
This commit is contained in:
		
							parent
							
								
									f381da0f78
								
							
						
					
					
						commit
						1e96c93557
					
				@ -95,7 +95,7 @@
 | 
				
			|||||||
    </thead>
 | 
					    </thead>
 | 
				
			||||||
    <tbody *ngIf="blocks$ | async as blocks">
 | 
					    <tbody *ngIf="blocks$ | async as blocks">
 | 
				
			||||||
      <tr *ngFor="let block of blocks">
 | 
					      <tr *ngFor="let block of blocks">
 | 
				
			||||||
        <td><a [routerLink]="['/block' | relativeUrl, block.id]" [state]="{ data: { block: block } }">{{ block.height }}</a></td>
 | 
					        <td><a [routerLink]="['/block' | relativeUrl, block.id]">{{ block.height }}</a></td>
 | 
				
			||||||
        <td class="d-none d-md-block">‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }}</td>
 | 
					        <td class="d-none d-md-block">‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }}</td>
 | 
				
			||||||
        <td><app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since></td>
 | 
					        <td><app-time-since [time]="block.timestamp" [fastRender]="true"></app-time-since></td>
 | 
				
			||||||
        <td class=""><app-amount [satoshis]="block['reward']" digitsInfo="1.2-2" [noFiat]="true"></app-amount></td>
 | 
					        <td class=""><app-amount [satoshis]="block['reward']" digitsInfo="1.2-2" [noFiat]="true"></app-amount></td>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,8 @@
 | 
				
			|||||||
import { Component, OnInit } from '@angular/core';
 | 
					import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
 | 
				
			||||||
import { FormBuilder, FormGroup } from '@angular/forms';
 | 
					import { FormBuilder, FormGroup } from '@angular/forms';
 | 
				
			||||||
import { ActivatedRoute } from '@angular/router';
 | 
					import { ActivatedRoute } from '@angular/router';
 | 
				
			||||||
import { once } from 'process';
 | 
					import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
 | 
				
			||||||
import { BehaviorSubject, combineLatest, from, merge, Observable } from 'rxjs';
 | 
					import { distinctUntilChanged, map, startWith, switchMap, tap } from 'rxjs/operators';
 | 
				
			||||||
import { delay, distinctUntilChanged, map, scan, startWith, switchMap, tap } from 'rxjs/operators';
 | 
					 | 
				
			||||||
import { BlockExtended, PoolStat } from 'src/app/interfaces/node-api.interface';
 | 
					import { BlockExtended, PoolStat } from 'src/app/interfaces/node-api.interface';
 | 
				
			||||||
import { ApiService } from 'src/app/services/api.service';
 | 
					import { ApiService } from 'src/app/services/api.service';
 | 
				
			||||||
import { StateService } from 'src/app/services/state.service';
 | 
					import { StateService } from 'src/app/services/state.service';
 | 
				
			||||||
@ -11,7 +10,8 @@ import { StateService } from 'src/app/services/state.service';
 | 
				
			|||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-pool',
 | 
					  selector: 'app-pool',
 | 
				
			||||||
  templateUrl: './pool.component.html',
 | 
					  templateUrl: './pool.component.html',
 | 
				
			||||||
  styleUrls: ['./pool.component.scss']
 | 
					  styleUrls: ['./pool.component.scss'],
 | 
				
			||||||
 | 
					  changeDetection: ChangeDetectionStrategy.OnPush
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export class PoolComponent implements OnInit {
 | 
					export class PoolComponent implements OnInit {
 | 
				
			||||||
  poolStats$: Observable<PoolStat>;
 | 
					  poolStats$: Observable<PoolStat>;
 | 
				
			||||||
@ -22,7 +22,6 @@ export class PoolComponent implements OnInit {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  blocks: BlockExtended[] = [];
 | 
					  blocks: BlockExtended[] = [];
 | 
				
			||||||
  poolId: number = undefined;
 | 
					  poolId: number = undefined;
 | 
				
			||||||
  isLoading = false;
 | 
					 | 
				
			||||||
  radioGroupForm: FormGroup;
 | 
					  radioGroupForm: FormGroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
 | 
				
			|||||||
@ -138,12 +138,9 @@ export class ApiService {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getPoolBlocks$(poolId: number, fromHeight: number): Observable<BlockExtended[]> {
 | 
					  getPoolBlocks$(poolId: number, fromHeight: number): Observable<BlockExtended[]> {
 | 
				
			||||||
    if (fromHeight !== undefined) {
 | 
					    return this.httpClient.get<BlockExtended[]>(
 | 
				
			||||||
      return this.httpClient.get<BlockExtended[]>(this.apiBaseUrl + this.apiBasePath +
 | 
					        this.apiBaseUrl + this.apiBasePath + `/api/v1/mining/pool/${poolId}/blocks` +
 | 
				
			||||||
        `/api/v1/mining/pool/${poolId}/blocks/${fromHeight}`);
 | 
					        (fromHeight !== undefined ? `/${fromHeight}` : '')
 | 
				
			||||||
    } else {
 | 
					      );
 | 
				
			||||||
      return this.httpClient.get<BlockExtended[]>(this.apiBaseUrl + this.apiBasePath +
 | 
					 | 
				
			||||||
        `/api/v1/mining/pool/${poolId}/blocks`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user