From b4682150527e211dcefb0a7cd042bed00fdd76c3 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 19 Jun 2026 17:29:13 -0700 Subject: [PATCH] [eric] electron: exempt same-origin navigations in main-window will-navigate so a reload (Restart tour) on the prod 4173 origin isn't re-opened as a recursive browser card --- electron/main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electron/main.js b/electron/main.js index f1387610..f2d8bc03 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1220,7 +1220,15 @@ function createWindow() { }); mainWindow.webContents.on('will-navigate', (event, url) => { - if (isDev && url.startsWith('http://localhost:3000')) return; + // Same-origin navigations are the app's own routing (reload, hash routes), + // never an external link to pop into a browser card. The old port-specific + // exemptions missed prod (renderer on 127.0.0.1:4173, not localhost:3000 or + // file://), so a reload, e.g. Restart tour, got intercepted and re-opened + // as a browser card loading the app itself (the recursive nested window). + try { + const current = mainWindow.webContents.getURL(); + if (current && new URL(url).origin === new URL(current).origin) return; + } catch (_) {} if (url.startsWith('file://')) return; event.preventDefault(); mainWindow.webContents.send('webview-new-window', url, mainWindow.webContents.id);