scroll to currently active stream on sidebar mount
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { favoritedStreams, tagList, MAX_TAG_WEIGHT } from '$lib/stores.svelte.ts';
|
||||
import * as streamCache from '$lib/streamCache.svelte.ts';
|
||||
@@ -39,6 +40,14 @@
|
||||
|
||||
let cacheUsage = $derived(streamCache.usage.bytes);
|
||||
|
||||
// autoscroll to center currently active stream on page load
|
||||
onMount(() => {
|
||||
if (!ctx.current) return;
|
||||
document
|
||||
.getElementById(`stream-${ctx.current.id}`)
|
||||
?.scrollIntoView({ block: 'center', behavior: 'instant' });
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (displayedStreams.size == 1) {
|
||||
listOpen = false;
|
||||
|
||||
Reference in New Issue
Block a user