Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iOS/DuckDuckGo/AIChat/AIChatContentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ extension AIChatContentHandler: AIChatUserScriptDelegate {
delegate?.aiChatContentHandlerDidReceivePageContextRequest(self)
}

if message == .setAIChatHistoryEnabled {
if message == .getAIChatNativeConfigValues {
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
Copy link
Copy Markdown
Contributor

@SabrinaTardio SabrinaTardio Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this does not work because the FE is not fully set up yet when we receive this message, that is why I was using the next message, but I thought it was only about showing chat history so I assumed it always happened.
However if we do if we do message != .getAIChatNativeConfigValues (so that it use the first useful message aka any after this)
seems to work in both cases.
It’s not ideal but we could use it while I get the FE to have the url parameter for toggling the page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SabrinaTardio it does work 👍
Addressed in 9e4999c

isFrontendReady = true
}

Expand Down
9 changes: 8 additions & 1 deletion iOS/DuckDuckGo/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,17 @@ class TabManager: TabManaging, TrackerAnimationSuppressing {
// In normal mode, removing the last tab auto-inserts a blank tab, so we skip
// inserting newTab (the auto-created tab serves the same purpose).
// In fire mode (allowsEmpty), no auto-insert happens, so we must always insert newTab.
if model.tabs.count == 1 && !model.allowsEmpty {
if model.tabs.count == 1 && !model.allowsEmpty && newTab.link == nil {
// Since we're not re-inserting we should use the proper removal to ensure
// things are cleaned up properly.
remove(tab: tab, clearTabHistory: clearTabHistory, in: model)
} else if model.tabs.count == 1 && !model.allowsEmpty {
// newTab has content (e.g. AI chat URL) so the auto-created blank won't suffice.
// Use removeTabs (no auto-insert) to avoid ending up with both newTab and an
// auto-created blank tab.
model.removeTabs([tab])
model.insert(tab: newTab, placement: .atEnd, selectNewTab: false)
clean(tabs: [tab], clearTabHistory: clearTabHistory)
} else {
model.insert(tab: newTab, placement: .replacing(tab), selectNewTab: false)
clean(tabs: [tab], clearTabHistory: clearTabHistory)
Expand Down
Loading