diff --git a/surfsense_desktop/src/modules/quick-ask.ts b/surfsense_desktop/src/modules/quick-ask.ts index 0058a738e..8eb094812 100644 --- a/surfsense_desktop/src/modules/quick-ask.ts +++ b/surfsense_desktop/src/modules/quick-ask.ts @@ -62,10 +62,17 @@ export function registerQuickAsk(): void { const text = clipboard.readText().trim(); if (!text) return; + const isExisting = quickAskWindow && !quickAskWindow.isDestroyed(); const cursor = screen.getCursorScreenPoint(); const win = createQuickAskWindow(cursor.x, cursor.y); - win.webContents.send(IPC_CHANNELS.QUICK_ASK_TEXT, text); + if (isExisting) { + win.webContents.send(IPC_CHANNELS.QUICK_ASK_TEXT, text); + } else { + win.webContents.once('did-finish-load', () => { + win.webContents.send(IPC_CHANNELS.QUICK_ASK_TEXT, text); + }); + } }); if (!ok) {