diff --git a/KDChat/Views/ChatBufferView.swift b/KDChat/Views/ChatBufferView.swift index 15675e5..b0c6baf 100644 --- a/KDChat/Views/ChatBufferView.swift +++ b/KDChat/Views/ChatBufferView.swift @@ -40,7 +40,9 @@ struct ChatBufferView: View { } .onChange(of: messages.count) { guard let last = messages.last, last.sessionId == manager.sessionId else { return } - proxy.scrollTo(last.persistentModelID, anchor: .bottom) + Task { @MainActor in + proxy.scrollTo(last.persistentModelID, anchor: .bottom) + } let isActive = bufferName == manager.activeBuffer let playBackground = UserDefaults.standard.bool(forKey: "sounds_background_buffers", default: true) diff --git a/KDChat/Views/DMConversationView.swift b/KDChat/Views/DMConversationView.swift index 1a4cf90..bf56813 100644 --- a/KDChat/Views/DMConversationView.swift +++ b/KDChat/Views/DMConversationView.swift @@ -36,7 +36,9 @@ struct DMConversationView: View { } .onChange(of: messages.count) { guard let last = messages.last, last.sessionId == manager.sessionId else { return } - proxy.scrollTo(last.persistentModelID, anchor: .bottom) + Task { @MainActor in + proxy.scrollTo(last.persistentModelID, anchor: .bottom) + } // Sound if UserDefaults.standard.bool(forKey: "sounds_enabled", default: true),