diff --git a/desktop/flow-typed/npm/electron_v22.0.0.js b/desktop/flow-typed/npm/electron_v22.0.0.js --- a/desktop/flow-typed/npm/electron_v22.0.0.js +++ b/desktop/flow-typed/npm/electron_v22.0.0.js @@ -458,6 +458,10 @@ event: T, listener: $ElementType, ): void; + removeListener: >( + event: T, + listener: $ElementType, + ) => void; inspectSharedWorker(): void; } declare type WebContentsEvents = { diff --git a/desktop/src/main.js b/desktop/src/main.js --- a/desktop/src/main.js +++ b/desktop/src/main.js @@ -226,7 +226,7 @@ const main = createMainWindow(urlPath); let loadedSuccessfully = true; - main.webContents.on('did-fail-load', () => { + const failedLoadHandler = () => { loadedSuccessfully = false; if (!splash.isDestroyed()) { splash.destroy(); @@ -239,7 +239,9 @@ loadedSuccessfully = true; main.loadURL(url); }, 1000); - }); + }; + + main.webContents.on('did-fail-load', failedLoadHandler); main.webContents.on('did-finish-load', () => { if (loadedSuccessfully) { @@ -250,6 +252,8 @@ error.destroy(); } + main.webContents.removeListener('did-fail-load', failedLoadHandler); + main.show(); if (app.isPackaged) {