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