From 149b8a1de5689a299c8182169470ee6314561b7d Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 22 Mar 2025 11:12:53 +0000 Subject: [PATCH] Lint connection status --- .../sync-client/src/services/connection-status.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/sync-client/src/services/connection-status.ts b/frontend/sync-client/src/services/connection-status.ts index ebf9361..b31d6b9 100644 --- a/frontend/sync-client/src/services/connection-status.ts +++ b/frontend/sync-client/src/services/connection-status.ts @@ -6,8 +6,8 @@ import { sleep } from "../utils/sleep"; export class ConnectionStatus { private static readonly UNTIL_RESOLUTION = Symbol(); private canFetch = true; - private until: Promise; - private resolveUntil: (result: Symbol) => void; + private until: Promise; + private resolveUntil: (result: symbol) => void; private rejectUntil: (reason: any) => void; public constructor( @@ -15,14 +15,14 @@ export class ConnectionStatus { private readonly logger: Logger ) { [this.until, this.resolveUntil, this.rejectUntil] = - createPromise(); + createPromise(); settings.addOnSettingsChangeHandlers((newSettings, oldSettings) => { if (oldSettings.isSyncEnabled != newSettings.isSyncEnabled) { this.canFetch = newSettings.isSyncEnabled; this.resolveUntil(ConnectionStatus.UNTIL_RESOLUTION); [this.until, this.resolveUntil, this.rejectUntil] = - createPromise(); + createPromise(); } }); } @@ -45,13 +45,13 @@ export class ConnectionStatus { ) { return async (input: RequestInfo | URL): Promise => { while (true) { - while (this.canFetch === false) { + while (!this.canFetch) { await this.until; } try { // https://github.com/jonbern/fetch-retry/blob/8684ef4e688375f623bd76f13add76dbc1d67cfb/index.js#L67C1-L70C21 - let _input = + const _input = typeof Request !== "undefined" && input instanceof Request ? input.clone() @@ -65,7 +65,7 @@ export class ConnectionStatus { result = await Promise.race([this.until, fetchPromise]); } while (result === ConnectionStatus.UNTIL_RESOLUTION); - let fetchResult: Response = result as Response; + const fetchResult: Response = result as Response; if (!fetchResult.ok) { this.logger.warn(