xP: fix automatic scrolling down

Showing channel logs cancelled the AbortController forever.
Thus store it within vnodes.
This commit is contained in:
Přemysl Eric Janouch 2022-09-28 21:05:02 +02:00
parent 5b57e9b41b
commit 941ee2f10c
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -566,12 +566,6 @@ let Topic = {
} }
let Buffer = { let Buffer = {
controller: new AbortController(),
onbeforeremove: vnode => {
Buffer.controller.abort()
},
onupdate: vnode => { onupdate: vnode => {
if (bufferAutoscroll) if (bufferAutoscroll)
vnode.dom.scrollTop = vnode.dom.scrollHeight vnode.dom.scrollTop = vnode.dom.scrollHeight
@ -579,8 +573,14 @@ let Buffer = {
oncreate: vnode => { oncreate: vnode => {
Buffer.onupdate(vnode) Buffer.onupdate(vnode)
vnode.state.controller = new AbortController()
window.addEventListener('resize', event => Buffer.onupdate(vnode), window.addEventListener('resize', event => Buffer.onupdate(vnode),
{signal: Buffer.controller.signal}) {signal: vnode.state.controller.signal})
},
onremove: vnode => {
vnode.state.controller.abort()
}, },
view: vnode => { view: vnode => {