Skip to content

Commit

Permalink
only shouldReload for native UI session restore
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx committed Feb 22, 2024
1 parent 5ba0ccb commit a84f70a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DuckDuckGo/Tab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -984,13 +984,14 @@ protocol NewWindowPolicyDecisionMaker {

@MainActor
private func shouldReload(_ url: URL, shouldLoadInBackground: Bool) -> Bool {
var isNativeUI: Bool {
var isSessionRestoredNativeUI: Bool {
guard case .loadCachedFromTabContent = self.interactionState else { return false }
let content = TabContent.contentFromURL(url, source: .ui)
return !content.isUrl && content.urlForWebView != nil
}
// don‘t reload in background unless shouldLoadInBackground
guard url.isValid,
webView.superview != nil || shouldLoadInBackground || isNativeUI,
webView.superview != nil || shouldLoadInBackground || isSessionRestoredNativeUI,
// don‘t reload when already loaded
webView.url != url || error != nil else { return false }

Expand Down

0 comments on commit a84f70a

Please sign in to comment.