diff --git a/src/main/app/initialize.ts b/src/main/app/initialize.ts index 1b2c8aab..bda850ae 100644 --- a/src/main/app/initialize.ts +++ b/src/main/app/initialize.ts @@ -345,11 +345,6 @@ async function initializeAfterAppReady() { updateSpellCheckerLocales(); } - if (wasUpdated(AppVersionManager.lastAppVersion)) { - clearAppCache(); - } - AppVersionManager.lastAppVersion = app.getVersion(); - if (typeof Config.canUpgrade === 'undefined') { // windows might not be ready, so we have to wait until it is Config.once('update', () => { @@ -472,6 +467,11 @@ async function initializeAfterAppReady() { callback(urlUtils.isTrustedURL(requestingURL, serverURL)); }); + if (wasUpdated(AppVersionManager.lastAppVersion)) { + clearAppCache(); + } + AppVersionManager.lastAppVersion = app.getVersion(); + handleMainWindowIsShown(); } diff --git a/src/main/app/utils.ts b/src/main/app/utils.ts index 07dcd38d..34569188 100644 --- a/src/main/app/utils.ts +++ b/src/main/app/utils.ts @@ -91,7 +91,11 @@ export function clearAppCache() { // TODO: clear cache on browserviews, not in the renderer. const mainWindow = MainWindow.get(); if (mainWindow) { - mainWindow.webContents.session.clearCache().then(mainWindow.reload); + mainWindow.webContents.session.clearCache(). + then(mainWindow.webContents.reload). + catch((err) => { + log.error('clearAppCache', err); + }); } else { //Wait for mainWindow setTimeout(clearAppCache, 100);