mirror of
https://github.com/mempool/mempool.git
synced 2025-04-01 08:28:13 +02:00
Merge pull request #2304 from mononaut/fix-sticky-block-error
Fix sticky error state on block page
This commit is contained in:
commit
558ddec0a1
@ -4,7 +4,7 @@ import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||
import { ElectrsApiService } from '../../services/electrs-api.service';
|
||||
import { switchMap, tap, throttleTime, catchError, map, shareReplay, startWith, pairwise } from 'rxjs/operators';
|
||||
import { Transaction, Vout } from '../../interfaces/electrs.interface';
|
||||
import { Observable, of, Subscription, asyncScheduler } from 'rxjs';
|
||||
import { Observable, of, Subscription, asyncScheduler, EMPTY } from 'rxjs';
|
||||
import { StateService } from '../../services/state.service';
|
||||
import { SeoService } from 'src/app/services/seo.service';
|
||||
import { WebsocketService } from 'src/app/services/websocket.service';
|
||||
@ -142,8 +142,21 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||
this.location.replaceState(
|
||||
this.router.createUrlTree([(this.network ? '/' + this.network : '') + '/block/', hash]).toString()
|
||||
);
|
||||
return this.apiService.getBlock$(hash);
|
||||
})
|
||||
return this.apiService.getBlock$(hash).pipe(
|
||||
catchError((err) => {
|
||||
this.error = err;
|
||||
this.isLoadingBlock = false;
|
||||
this.isLoadingOverview = false;
|
||||
return EMPTY;
|
||||
})
|
||||
);
|
||||
}),
|
||||
catchError((err) => {
|
||||
this.error = err;
|
||||
this.isLoadingBlock = false;
|
||||
this.isLoadingOverview = false;
|
||||
return EMPTY;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@ -152,7 +165,14 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||
return of(blockInCache);
|
||||
}
|
||||
|
||||
return this.apiService.getBlock$(blockHash);
|
||||
return this.apiService.getBlock$(blockHash).pipe(
|
||||
catchError((err) => {
|
||||
this.error = err;
|
||||
this.isLoadingBlock = false;
|
||||
this.isLoadingOverview = false;
|
||||
return EMPTY;
|
||||
})
|
||||
);
|
||||
}
|
||||
}),
|
||||
tap((block: BlockExtended) => {
|
||||
@ -168,7 +188,6 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.block = block;
|
||||
this.blockHeight = block.height;
|
||||
const direction = (this.lastBlockHeight < this.blockHeight) ? 'right' : 'left';
|
||||
this.lastBlockHeight = this.blockHeight;
|
||||
this.nextBlockHeight = block.height + 1;
|
||||
this.setNextAndPreviousBlockLink();
|
||||
|
Loading…
x
Reference in New Issue
Block a user