Merge pull request #3948 from mempool/mononaut/loading-transaction
show "loading" message while checking for cached txs
This commit is contained in:
		
						commit
						31336d47e2
					
				@ -306,7 +306,7 @@
 | 
			
		||||
 | 
			
		||||
  </ng-template>
 | 
			
		||||
 | 
			
		||||
  <ng-template [ngIf]="isLoadingTx && !error">
 | 
			
		||||
  <ng-template [ngIf]="(isLoadingTx && !error) || loadingCachedTx">
 | 
			
		||||
 | 
			
		||||
    <div class="box">
 | 
			
		||||
      <div class="row">
 | 
			
		||||
@ -451,7 +451,7 @@
 | 
			
		||||
 | 
			
		||||
  </ng-template>
 | 
			
		||||
 | 
			
		||||
  <ng-template [ngIf]="error">
 | 
			
		||||
  <ng-template [ngIf]="error && !loadingCachedTx">
 | 
			
		||||
 | 
			
		||||
    <div class="text-center" *ngIf="waitingForTransaction; else errorTemplate">
 | 
			
		||||
      <h3 i18n="transaction.error.transaction-not-found">Transaction not found.</h3>
 | 
			
		||||
 | 
			
		||||
@ -39,6 +39,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
  isLoadingTx = true;
 | 
			
		||||
  error: any = undefined;
 | 
			
		||||
  errorUnblinded: any = undefined;
 | 
			
		||||
  loadingCachedTx = false;
 | 
			
		||||
  waitingForTransaction = false;
 | 
			
		||||
  latestBlock: BlockExtended;
 | 
			
		||||
  transactionTime = -1;
 | 
			
		||||
@ -203,6 +204,9 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
    this.fetchCachedTxSubscription = this.fetchCachedTx$
 | 
			
		||||
    .pipe(
 | 
			
		||||
      tap(() => {
 | 
			
		||||
        this.loadingCachedTx = true;
 | 
			
		||||
      }),
 | 
			
		||||
      switchMap((txId) =>
 | 
			
		||||
        this.apiService
 | 
			
		||||
          .getRbfCachedTx$(txId)
 | 
			
		||||
@ -211,6 +215,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
        return of(null);
 | 
			
		||||
      })
 | 
			
		||||
    ).subscribe((tx) => {
 | 
			
		||||
      this.loadingCachedTx = false;
 | 
			
		||||
      if (!tx) {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
@ -342,6 +347,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
          this.tx.feePerVsize = tx.fee / (tx.weight / 4);
 | 
			
		||||
          this.isLoadingTx = false;
 | 
			
		||||
          this.error = undefined;
 | 
			
		||||
          this.loadingCachedTx = false;
 | 
			
		||||
          this.waitingForTransaction = false;
 | 
			
		||||
          this.websocketService.startTrackTransaction(tx.txid);
 | 
			
		||||
          this.graphExpanded = false;
 | 
			
		||||
@ -411,6 +417,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
    this.txReplacedSubscription = this.stateService.txReplaced$.subscribe((rbfTransaction) => {
 | 
			
		||||
      if (!this.tx) {
 | 
			
		||||
        this.error = new Error();
 | 
			
		||||
        this.loadingCachedTx = false;
 | 
			
		||||
        this.waitingForTransaction = false;
 | 
			
		||||
      }
 | 
			
		||||
      this.rbfTransaction = rbfTransaction;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user