scroll to currently active stream on sidebar mount

This commit is contained in:
2026-09-27 16:26:26 +02:00
parent 3aae8a0130
commit 3d67b58b03
+9
View File
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { favoritedStreams, tagList, MAX_TAG_WEIGHT } from '$lib/stores.svelte.ts'; import { favoritedStreams, tagList, MAX_TAG_WEIGHT } from '$lib/stores.svelte.ts';
import * as streamCache from '$lib/streamCache.svelte.ts'; import * as streamCache from '$lib/streamCache.svelte.ts';
@@ -39,6 +40,14 @@
let cacheUsage = $derived(streamCache.usage.bytes); 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(() => { $effect(() => {
if (displayedStreams.size == 1) { if (displayedStreams.size == 1) {
listOpen = false; listOpen = false;