mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-10 18:33:32 +00:00
fix(app): simplify timeline bottom anchor
This commit is contained in:
parent
d4db264a1a
commit
44c0ec7847
1 changed files with 4 additions and 4 deletions
|
|
@ -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 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue