use SvelteSet instead of Set for favoritedStreams

This commit is contained in:
2025-07-06 22:31:55 +02:00
parent dc84db8c79
commit 347438928a
8 changed files with 19 additions and 20 deletions
+5 -6
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { untrack } from 'svelte';
import { goto } from '$app/navigation';
import { currentStream, favoritedStreams } from '$lib/stores.js';
import { currentStream, favoritedStreams } from '$lib/stores.svelte.js';
import { hashColor, shorthandCode, formatSecondsToHms, formatDate } from '$lib/utils.js';
import TagSelect from './TagSelect.svelte';
@@ -40,10 +40,9 @@
}
function updateFavorites(stream) {
$favoritedStreams.has(stream['id'])
? $favoritedStreams.delete(stream['id'])
: $favoritedStreams.add(stream['id']);
$favoritedStreams = $favoritedStreams; // for reactivity
favoritedStreams.has(stream['id'])
? favoritedStreams.delete(stream['id'])
: favoritedStreams.add(stream['id']);
}
</script>
@@ -57,7 +56,7 @@
<ul class="stream-list">
{#each streams as stream}
{@const favorited = $favoritedStreams.has(stream['id'])}
{@const favorited = favoritedStreams.has(stream['id'])}
{@const current = $currentStream['id'] === stream['id']}
<li
hidden={!displayedStreams.includes(stream) || (favoritesOnly && !favorited)}