From 93f58f1d38ecf8d04192401b3f3f3bd75e1204d6 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 19 Dec 2024 07:17:25 +0700 Subject: [PATCH] PR comments --- .../src/xforge-common/retrying-request.service.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts b/src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts index b69f36fff5..b33bec9499 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts +++ b/src/SIL.XForge.Scripture/ClientApp/src/xforge-common/retrying-request.service.ts @@ -1,5 +1,5 @@ import { Inject, Injectable } from '@angular/core'; -import { lastValueFrom, Observable, Subject } from 'rxjs'; +import { firstValueFrom, Observable, Subject } from 'rxjs'; import { filter, take } from 'rxjs/operators'; import { CONSOLE, ConsoleInterface } from './browser-globals'; import { CommandErrorCode, CommandService } from './command.service'; @@ -96,7 +96,7 @@ export class RetryingRequest { private async invoke(options: FetchOptions): Promise { while (!this.canceled && this.status !== 'complete') { - const online = await lastValueFrom(this.online$.pipe(take(1))); + const online = await firstValueFrom(this.online$); if (online !== true) { this.status = 'offline'; await this.uponOnline(); @@ -124,12 +124,7 @@ export class RetryingRequest { } private async uponOnline(): Promise { - await lastValueFrom( - this.online$.pipe( - filter(isOnline => isOnline), - take(1) - ) - ); + await firstValueFrom(this.online$.pipe(filter(isOnline => isOnline))); } private isNetworkError(error: unknown): boolean {