Bugfix: Refetch unconfirmed transaction when returning back online.
This commit is contained in:
parent
a244458928
commit
ffa97fedf3
@ -3,7 +3,7 @@ import { ElectrsApiService } from '../../services/electrs-api.service';
|
|||||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||||
import { switchMap, filter, take } from 'rxjs/operators';
|
import { switchMap, filter, take } from 'rxjs/operators';
|
||||||
import { Transaction, Block } from '../../interfaces/electrs.interface';
|
import { Transaction, Block } from '../../interfaces/electrs.interface';
|
||||||
import { of } from 'rxjs';
|
import { of, merge } from 'rxjs';
|
||||||
import { StateService } from '../../services/state.service';
|
import { StateService } from '../../services/state.service';
|
||||||
import { WebsocketService } from '../../services/websocket.service';
|
import { WebsocketService } from '../../services/websocket.service';
|
||||||
import { AudioService } from 'src/app/services/audio.service';
|
import { AudioService } from 'src/app/services/audio.service';
|
||||||
@ -49,11 +49,19 @@ export class TransactionComponent implements OnInit, OnDestroy {
|
|||||||
this.isLoadingTx = true;
|
this.isLoadingTx = true;
|
||||||
this.transactionTime = -1;
|
this.transactionTime = -1;
|
||||||
document.body.scrollTo(0, 0);
|
document.body.scrollTo(0, 0);
|
||||||
if (history.state.data) {
|
return merge(
|
||||||
return of(history.state.data);
|
of(true),
|
||||||
} else {
|
this.stateService.connectionState$
|
||||||
return this.electrsApiService.getTransaction$(this.txId);
|
.pipe(filter((state) => state === 2 && this.tx && !this.tx.status.confirmed) ),
|
||||||
}
|
)
|
||||||
|
.pipe(
|
||||||
|
switchMap(() => {
|
||||||
|
if (history.state.data) {
|
||||||
|
return of(history.state.data);
|
||||||
|
}
|
||||||
|
return this.electrsApiService.getTransaction$(this.txId);
|
||||||
|
})
|
||||||
|
);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe((tx: Transaction) => {
|
.subscribe((tx: Transaction) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user