mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
Various updater fixes (#1170)
- Fixes updater status not showing on tabs that were previously unloaded. - Fixes updater status showing as error when not connected to the internet - Adds delay after setting installing status to avoid race condition with any window close event handlers. This may fix #1167
This commit is contained in:
parent
17adf7b2c3
commit
b3fdbbc331
@ -10,6 +10,7 @@ import { FileService } from "../frontend/app/store/services";
|
|||||||
import { RpcApi } from "../frontend/app/store/wshclientapi";
|
import { RpcApi } from "../frontend/app/store/wshclientapi";
|
||||||
import { isDev } from "../frontend/util/isdev";
|
import { isDev } from "../frontend/util/isdev";
|
||||||
import { fireAndForget } from "../frontend/util/util";
|
import { fireAndForget } from "../frontend/util/util";
|
||||||
|
import { delay } from "./emain-util";
|
||||||
import { getAllWaveWindows, getFocusedWaveWindow } from "./emain-viewmgr";
|
import { getAllWaveWindows, getFocusedWaveWindow } from "./emain-viewmgr";
|
||||||
import { ElectronWshClient } from "./emain-wsh";
|
import { ElectronWshClient } from "./emain-wsh";
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ export class Updater {
|
|||||||
autoUpdater.on("error", (err) => {
|
autoUpdater.on("error", (err) => {
|
||||||
console.log("updater error");
|
console.log("updater error");
|
||||||
console.log(err);
|
console.log(err);
|
||||||
this.status = "error";
|
if (!err.message.includes("net::ERR_INTERNET_DISCONNECTED")) this.status = "error";
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on("checking-for-update", () => {
|
autoUpdater.on("checking-for-update", () => {
|
||||||
@ -188,7 +189,7 @@ export class Updater {
|
|||||||
const focusedWindow = getFocusedWaveWindow();
|
const focusedWindow = getFocusedWaveWindow();
|
||||||
await dialog.showMessageBox(focusedWindow ?? allWindows[0], dialogOpts).then(({ response }) => {
|
await dialog.showMessageBox(focusedWindow ?? allWindows[0], dialogOpts).then(({ response }) => {
|
||||||
if (response === 0) {
|
if (response === 0) {
|
||||||
this.installUpdate();
|
fireAndForget(async () => this.installUpdate());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -197,9 +198,10 @@ export class Updater {
|
|||||||
/**
|
/**
|
||||||
* Restarts the app and installs an update if it is available.
|
* Restarts the app and installs an update if it is available.
|
||||||
*/
|
*/
|
||||||
installUpdate() {
|
async installUpdate() {
|
||||||
if (this.status == "ready") {
|
if (this.status == "ready") {
|
||||||
this.status = "installing";
|
this.status = "installing";
|
||||||
|
await delay(1000);
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ async function reinitWave() {
|
|||||||
document.title = `Wave Terminal - ${initialTab.name}`; // TODO update with tab name change
|
document.title = `Wave Terminal - ${initialTab.name}`; // TODO update with tab name change
|
||||||
getApi().setWindowInitStatus("wave-ready");
|
getApi().setWindowInitStatus("wave-ready");
|
||||||
globalStore.set(atoms.reinitVersion, globalStore.get(atoms.reinitVersion) + 1);
|
globalStore.set(atoms.reinitVersion, globalStore.get(atoms.reinitVersion) + 1);
|
||||||
|
globalStore.set(atoms.updaterStatusAtom, getApi().getUpdaterStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadAllWorkspaceTabs(ws: Workspace) {
|
function reloadAllWorkspaceTabs(ws: Workspace) {
|
||||||
|
Loading…
Reference in New Issue
Block a user