From 4d2f516830f121348a37a8f2ab4dfd0b983e068d Mon Sep 17 00:00:00 2001 From: Erik Moura Date: Mon, 10 Jul 2023 23:47:42 -0300 Subject: [PATCH] refactor: use a boolean instead of the `Lock` object --- src/renderer/state.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/state.ts b/src/renderer/state.ts index bdcf363240..a6ddd374dd 100644 --- a/src/renderer/state.ts +++ b/src/renderer/state.ts @@ -226,8 +226,8 @@ export class AppState { }); } - // Lock on the active Electron version that prevents other windows from removing it - private versionLock: Lock | null = null; + // Do we have a lock on the active Electron version that prevents other windows from removing it? + private hasActiveLock = false; // Used to release the lock when the current window switches Electron versions private versionLockController = new AbortController(); @@ -989,7 +989,7 @@ export class AppState { return; } - if (this.versionLock) { + if (this.hasActiveLock) { console.log(`Releasing lock on version ${this.version}`); // release the lock on the previous version @@ -1007,7 +1007,7 @@ export class AppState { this.getVersionLockName(version), { mode: 'shared' }, (lock) => { - this.versionLock = lock; + this.hasActiveLock = Boolean(lock); /** * The lock is released when this promise resolves, so we keep it in the