scroll to top of attention on switch
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user