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
This commit is contained in:
Evan Simkowitz 2024-12-11 10:33:37 -08:00 committed by GitHub
parent ed17c76ada
commit 6684a5c2b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();