From 8f94fd0f503d353a219d464792fa562da26aadf3 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Mon, 23 Feb 2026 19:56:38 -0800 Subject: [PATCH] Fix stale browser favicon after navigation --- Sources/Panels/BrowserPanel.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/Panels/BrowserPanel.swift b/Sources/Panels/BrowserPanel.swift index 420ba6d1..39805285 100644 --- a/Sources/Panels/BrowserPanel.swift +++ b/Sources/Panels/BrowserPanel.swift @@ -1647,6 +1647,9 @@ final class BrowserPanel: Panel, ObservableObject { faviconTask?.cancel() faviconTask = nil lastFaviconURLString = nil + // Clear the previous page's favicon so it never persists across navigations. + // The loading spinner covers this gap; didFinish will fetch the new favicon. + faviconPNGData = nil loadingGeneration &+= 1 loadingEndWorkItem?.cancel() loadingEndWorkItem = nil @@ -2526,6 +2529,10 @@ private class BrowserNavigationDelegate: NSObject, WKNavigationDelegate { func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { NSLog("BrowserPanel navigation failed: %@", error.localizedDescription) + // Treat committed-navigation failures the same as provisional ones so + // stale favicon/title state from the prior page gets cleared. + let failedURL = webView.url?.absoluteString ?? "" + didFailNavigation?(webView, failedURL) } func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {