fix(app): session timeline jumping on scroll (#18993)
This commit is contained in:
@@ -246,14 +246,19 @@ function createSessionHistoryWindow(input: SessionHistoryWindowInput) {
|
|||||||
|
|
||||||
if (added <= 0) return
|
if (added <= 0) return
|
||||||
if (growth <= 0) return
|
if (growth <= 0) return
|
||||||
|
|
||||||
|
if (opts?.prefetch) {
|
||||||
|
const current = turnStart()
|
||||||
|
preserveScroll(() => setTurnStart(current + growth))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (turnStart() !== start) return
|
if (turnStart() !== start) return
|
||||||
|
|
||||||
const reveal = !opts?.prefetch
|
|
||||||
const currentRendered = renderedUserMessages().length
|
const currentRendered = renderedUserMessages().length
|
||||||
const base = Math.max(beforeRendered, currentRendered)
|
const base = Math.max(beforeRendered, currentRendered)
|
||||||
const target = reveal ? Math.min(afterVisible, base + turnBatch) : base
|
const target = Math.min(afterVisible, base + turnBatch)
|
||||||
const nextStart = Math.max(0, afterVisible - target)
|
preserveScroll(() => setTurnStart(Math.max(0, afterVisible - target)))
|
||||||
preserveScroll(() => setTurnStart(nextStart))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onScrollerScroll = () => {
|
const onScrollerScroll = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user