From 9c519a5f64fab56a10e0eac511885953101494b7 Mon Sep 17 00:00:00 2001 From: Fernando Bunn Date: Thu, 19 Dec 2024 14:49:11 -0300 Subject: [PATCH] Fix issue loading query after memory warning --- .../Sources/AIChat/Public API/AIChatViewController.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LocalPackages/AIChat/Sources/AIChat/Public API/AIChatViewController.swift b/LocalPackages/AIChat/Sources/AIChat/Public API/AIChatViewController.swift index 79e3a1ad31..6cb555cf1b 100644 --- a/LocalPackages/AIChat/Sources/AIChat/Public API/AIChatViewController.swift +++ b/LocalPackages/AIChat/Sources/AIChat/Public API/AIChatViewController.swift @@ -87,8 +87,12 @@ extension AIChatViewController { // MARK: - Public functions extension AIChatViewController { public func loadQuery(_ query: URLQueryItem) { - webViewController?.loadQuery(query) - } + // Ensure the webViewController is added before loading the query + if webViewController == nil { + addWebViewController() + } + webViewController?.loadQuery(query) + } } // MARK: - Views Setup