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