Skip to content

Commit

Permalink
fix(timeline): auto scroll to bottom sometimes turning off
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Mar 9, 2022
1 parent a066ce3 commit 89870ea
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default defineComponent({
function onScroll () {
const scrollerEl = scroller.value.$el
isAtScrollBottom.value = scrollerEl.scrollTop + scrollerEl.clientHeight >= scrollerEl.scrollHeight - 100
isAtScrollBottom.value = scrollerEl.scrollTop + scrollerEl.clientHeight >= scrollerEl.scrollHeight - 400
}
watch(scroller, value => {
Expand Down Expand Up @@ -151,8 +151,10 @@ export default defineComponent({
function scrollToBottom () {
if (!scroller.value) return
const scrollerEl = scroller.value.$el
scrollerEl.scrollTop = scrollerEl.scrollHeight
requestAnimationFrame(() => {
const scrollerEl = scroller.value.$el
scrollerEl.scrollTop = scrollerEl.scrollHeight
})
}
// Important: Watch this after the scroll to inspect event watchers
Expand Down Expand Up @@ -241,7 +243,7 @@ export default defineComponent({
:items="filteredEvents"
:item-size="itemHeight"
class="flex-1"
@scroll.native="onScroll()"
@scroll.native.passive="onScroll()"
>
<template #default="{ item: event }">
<TimelineEventListItem
Expand Down

0 comments on commit 89870ea

Please sign in to comment.