diff --git a/apps/swift-ios/Features/Workspace/WorkspaceView.swift b/apps/swift-ios/Features/Workspace/WorkspaceView.swift index 38b83c823cce..ae52de484cf0 100644 --- a/apps/swift-ios/Features/Workspace/WorkspaceView.swift +++ b/apps/swift-ios/Features/Workspace/WorkspaceView.swift @@ -329,7 +329,7 @@ public struct WorkspaceView: View { model: model, thread: thread, submitMessage: submitMessage, - onNavigateBack: closeSelectedThread + onNavigateBack: collapseToSidebar ) .id(id) } else { @@ -638,6 +638,15 @@ public struct WorkspaceView: View { preferredCompactColumn = .sidebar } + /// Compact-width swipe back. Mirrors the system back button: collapse the + /// column but keep the selection so the thread view is re-shown, not + /// destroyed and recreated. Recreating it inside the split view's + /// interactive pop fires a spurious onDisappear on the next open, which + /// releases the thread mid-load and leaves stale cached content. + private func collapseToSidebar() { + preferredCompactColumn = .sidebar + } + @MainActor private func openProjectCreation() { showingNewTask = false