use SvelteSet instead of Set for favoritedStreams
This commit is contained in:
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user