scroll to top of attention on switch

This commit is contained in:
Ian Gulliver
2026-10-19 16:57:16 -07:00
parent fc07b5efd7
commit 01cabc0e43
+10 -4
View File
@@ -751,22 +751,27 @@ private struct TranscriptScroll: View {
var body: some View {
let running = model.running
ScrollView {
VStack(alignment: .leading, spacing: 12) {
VStack(alignment: .leading, spacing: 0) {
if model.key == nil {
Muted(text: model.empty)
.padding(.top, 12)
} else {
if model.loading {
Muted(text: "loading…")
.padding(.top, 12)
}
if model.hasOlder || model.older != nil {
Muted(text: "loading earlier…")
.opacity(model.fetching || model.older != nil ? 1 : 0)
.padding(.top, 12)
}
ForEach(model.builder.root.rows) { row in
ForEach(model.builder.root.rows.filter { !$0.hidden }) { row in
RowView(row: row, model: model, nested: false)
.padding(.top, 12)
}
ForEach(model.builder.pending) { p in
PendingView(pending: p, model: model)
.padding(.top, 12)
}
}
}
@@ -778,7 +783,8 @@ private struct TranscriptScroll: View {
.offset(y: 8)
}
}
.padding(16)
.padding([.horizontal, .bottom], 16)
.padding(.top, 4)
}
.scrollPosition($position)
.defaultScrollAnchor(.bottom)
@@ -815,7 +821,7 @@ private struct TranscriptScroll: View {
model.prependOlder()
}
}
.onChange(of: model.held) { _, id in
.onChange(of: model.held, initial: true) { _, id in
if !model.stuck || scrolling {
return
}