Defer rendering a chat room for a frame
This commit is contained in:
parent
72ee0c9ed6
commit
8243f4d245
1 changed files with 6 additions and 2 deletions
|
|
@ -454,14 +454,18 @@
|
|||
const onEditPrevious = () => ifLet($events.toReversed().find(canEditEvent), onEditEvent)
|
||||
|
||||
onMount(() => {
|
||||
start()
|
||||
// Defer rendering until navigation finishes
|
||||
let frame = requestAnimationFrame(() => {
|
||||
frame = requestAnimationFrame(start)
|
||||
})
|
||||
|
||||
const unsubscribeActive = documentActive.subscribe(onActiveChange)
|
||||
|
||||
return () => {
|
||||
// Wrap in a closure to avoid calling a stale cleanup function
|
||||
cleanup?.()
|
||||
unsubscribeActive()
|
||||
cancelAnimationFrame(frame)
|
||||
document.removeEventListener("visibilitychange", onVisibilityChange)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue