stabilize scroll event wiring
This commit is contained in:
@@ -215,12 +215,6 @@ export default function MessageSection(props: MessageSectionProps) {
|
||||
scheduleAnchorScroll()
|
||||
}
|
||||
|
||||
createEffect(() => {
|
||||
if (props.registerScrollToBottom) {
|
||||
props.registerScrollToBottom(() => scrollToBottom(true))
|
||||
}
|
||||
})
|
||||
|
||||
function handleScroll() {
|
||||
if (!containerRef) return
|
||||
if (pendingScrollFrame !== null) {
|
||||
@@ -244,6 +238,12 @@ export default function MessageSection(props: MessageSectionProps) {
|
||||
})
|
||||
}
|
||||
|
||||
createEffect(() => {
|
||||
if (props.registerScrollToBottom) {
|
||||
props.registerScrollToBottom(() => scrollToBottom(true))
|
||||
}
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
const target = containerRef
|
||||
const loading = props.loading
|
||||
@@ -301,13 +301,6 @@ export default function MessageSection(props: MessageSectionProps) {
|
||||
}
|
||||
updateScrollIndicatorsFromVisibility()
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
if (autoScroll() && bottomSentinel()) {
|
||||
scheduleAnchorScroll()
|
||||
}
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
const container = scrollElement()
|
||||
const topTarget = topSentinel()
|
||||
@@ -337,6 +330,7 @@ export default function MessageSection(props: MessageSectionProps) {
|
||||
})
|
||||
|
||||
onCleanup(() => {
|
||||
|
||||
if (pendingScrollFrame !== null) {
|
||||
cancelAnimationFrame(pendingScrollFrame)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user