fix(app): simplify timeline bottom anchor

This commit is contained in:
LukeParkerDev
2026-05-13 13:54:07 +10:00
parent d4db264a1a
commit 44c0ec7847
@@ -721,14 +721,13 @@ export function MessageTimeline(props: {
const key = sessionKey()
if (bottomAnchorSessionKey === key) return
if (!virtualizer) return
if (timelineRowKeys().length === 0) return
const keys = timelineRowKeys()
if (keys.length === 0) return
bottomAnchorSessionKey = key
if (!props.shouldAnchorBottom()) return
virtualizer.scrollToIndex(timelineRowKeys().length - 1, { align: "end" })
virtualizer.scrollToIndex(keys.length - 1, { align: "end" })
}
createEffect(maybeAnchorBottom)
createEffect(
on(
() => [sessionKey(), timelineRowKeys()] as const,
@@ -739,6 +738,7 @@ export function MessageTimeline(props: {
if (virtualizer) {
virtualizerSessionKey = cacheSessionKey
virtualizerRowKeys = cacheRowKeys
maybeAnchorBottom()
}
},
{ defer: true },