Run scroll to bottom in a task on the main actor for chat and dm buffer views
This should hopefully avoid the reported bug where a user can't scroll to with voiceover / presumably see their last message until sending another.
This commit is contained in:
parent
76ebe0f771
commit
6c404ba7fd
2 changed files with 6 additions and 2 deletions
|
|
@ -40,7 +40,9 @@ struct ChatBufferView: View {
|
||||||
}
|
}
|
||||||
.onChange(of: messages.count) {
|
.onChange(of: messages.count) {
|
||||||
guard let last = messages.last, last.sessionId == manager.sessionId else { return }
|
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 isActive = bufferName == manager.activeBuffer
|
||||||
let playBackground = UserDefaults.standard.bool(forKey: "sounds_background_buffers", default: true)
|
let playBackground = UserDefaults.standard.bool(forKey: "sounds_background_buffers", default: true)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@ struct DMConversationView: View {
|
||||||
}
|
}
|
||||||
.onChange(of: messages.count) {
|
.onChange(of: messages.count) {
|
||||||
guard let last = messages.last, last.sessionId == manager.sessionId else { return }
|
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
|
// Sound
|
||||||
if UserDefaults.standard.bool(forKey: "sounds_enabled", default: true),
|
if UserDefaults.standard.bool(forKey: "sounds_enabled", default: true),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue