diff --git a/electron/handlers/update.ts b/electron/handlers/update.ts
index 690c36d517..5e2200e519 100644
--- a/electron/handlers/update.ts
+++ b/electron/handlers/update.ts
@@ -39,6 +39,7 @@ export function handleAppUpdates() {
})
if (action.response === 0) {
trayManager.destroyCurrentTray()
+ windowManager.closeQuickAskWindow()
waitingToInstallVersion = _info?.version
autoUpdater.quitAndInstall()
}
diff --git a/electron/main.ts b/electron/main.ts
index cdc001af4c..47d4f19f46 100644
--- a/electron/main.ts
+++ b/electron/main.ts
@@ -1,4 +1,4 @@
-import { app, BrowserWindow, Tray } from 'electron'
+import { app, BrowserWindow } from 'electron'
import { join } from 'path'
/**
@@ -11,7 +11,7 @@ import { getAppConfigurations, log } from '@janhq/core/node'
* IPC Handlers
**/
import { injectHandler } from './handlers/common'
-import { handleAppUpdates, waitingToInstallVersion } from './handlers/update'
+import { handleAppUpdates } from './handlers/update'
import { handleAppIPCs } from './handlers/native'
/**
@@ -96,7 +96,11 @@ app.once('quit', () => {
app.once('window-all-closed', () => {
// Feature Toggle for Quick Ask
- if (getAppConfigurations().quick_ask && !waitingToInstallVersion) return
+ if (
+ getAppConfigurations().quick_ask &&
+ !windowManager.isQuickAskWindowDestroyed()
+ )
+ return
cleanUpAndQuit()
})
diff --git a/electron/managers/window.ts b/electron/managers/window.ts
index f24d25c61a..2faa794c98 100644
--- a/electron/managers/window.ts
+++ b/electron/managers/window.ts
@@ -45,7 +45,7 @@ class WindowManager {
windowManager.mainWindow?.on('close', function (evt) {
// Feature Toggle for Quick Ask
if (!getAppConfigurations().quick_ask) return
-
+
if (!isAppQuitting) {
evt.preventDefault()
windowManager.hideMainWindow()
@@ -93,10 +93,20 @@ class WindowManager {
this._quickAskWindowVisible = true
}
+ closeQuickAskWindow(): void {
+ this._quickAskWindow?.close()
+ this._quickAskWindow?.destroy()
+ this._quickAskWindowVisible = false
+ }
+
isQuickAskWindowVisible(): boolean {
return this._quickAskWindowVisible
}
+ isQuickAskWindowDestroyed(): boolean {
+ return this._quickAskWindow?.isDestroyed() ?? true
+ }
+
expandQuickAskWindow(heightOffset: number): void {
const width = quickAskWindowConfig.width!
const height = quickAskWindowConfig.height! + heightOffset
@@ -112,8 +122,12 @@ class WindowManager {
}
cleanUp(): void {
+ this.mainWindow?.close()
this.mainWindow?.destroy()
+ this.mainWindow = undefined
+ this._quickAskWindow?.close()
this._quickAskWindow?.destroy()
+ this._quickAskWindow = undefined
this._quickAskWindowVisible = false
this._mainWindowVisible = false
}
diff --git a/web/screens/Chat/ErrorMessage/index.tsx b/web/screens/Chat/ErrorMessage/index.tsx
index 1aea38acdb..5567956bdf 100644
--- a/web/screens/Chat/ErrorMessage/index.tsx
+++ b/web/screens/Chat/ErrorMessage/index.tsx
@@ -48,7 +48,7 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
)
default:
- return message.content[0]?.text?.value
+ return
Jan’s in beta. Access