Skip to content

Commit 89870ea

Browse files
committed
fix(timeline): auto scroll to bottom sometimes turning off
1 parent a066ce3 commit 89870ea

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/app-frontend/src/features/timeline/TimelineEventList.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default defineComponent({
100100
101101
function onScroll () {
102102
const scrollerEl = scroller.value.$el
103-
isAtScrollBottom.value = scrollerEl.scrollTop + scrollerEl.clientHeight >= scrollerEl.scrollHeight - 100
103+
isAtScrollBottom.value = scrollerEl.scrollTop + scrollerEl.clientHeight >= scrollerEl.scrollHeight - 400
104104
}
105105
106106
watch(scroller, value => {
@@ -151,8 +151,10 @@ export default defineComponent({
151151
function scrollToBottom () {
152152
if (!scroller.value) return
153153
154-
const scrollerEl = scroller.value.$el
155-
scrollerEl.scrollTop = scrollerEl.scrollHeight
154+
requestAnimationFrame(() => {
155+
const scrollerEl = scroller.value.$el
156+
scrollerEl.scrollTop = scrollerEl.scrollHeight
157+
})
156158
}
157159
158160
// Important: Watch this after the scroll to inspect event watchers
@@ -241,7 +243,7 @@ export default defineComponent({
241243
:items="filteredEvents"
242244
:item-size="itemHeight"
243245
class="flex-1"
244-
@scroll.native="onScroll()"
246+
@scroll.native.passive="onScroll()"
245247
>
246248
<template #default="{ item: event }">
247249
<TimelineEventListItem

0 commit comments

Comments
 (0)