From 6684a5c2b8adeab84ff622028562edafb9e992c7 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 11 Dec 2024 10:33:37 -0800 Subject: [PATCH] Only call `WebViewModel.handleNavigate` for main frame navigations (#1488) Navigation events are issued not just for main page navigations, but also for iframes, among other things. With our old behavior, if an iframe tries to load in a webpage, we would update the webview url and make the iframe the primary page, which is wrong. Now, we only do this for main frame navigations. closes #1487 --- frontend/app/view/webview/webview.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/app/view/webview/webview.tsx b/frontend/app/view/webview/webview.tsx index bfc8e11f2..1df743cd6 100644 --- a/frontend/app/view/webview/webview.tsx +++ b/frontend/app/view/webview/webview.tsx @@ -532,8 +532,11 @@ const WebView = memo(({ model, onFailLoad }: WebViewProps) => { return; } const navigateListener = (e: any) => { - setErrorText(""); - model.handleNavigate(e.url); + console.log("webview did-navigate event:", e); + if (e.isMainFrame) { + setErrorText(""); + model.handleNavigate(e.url); + } }; const newWindowHandler = (e: any) => { e.preventDefault();