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

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)}

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import Select from 'svelte-select';
import { tagList } from '$lib/stores.js';
import { tagList } from '$lib/stores.svelte.js';
let { checked = $bindable([]), remainingTags = [], listOpen = $bindable() } = $props();
let items = $state(tagList.map((x) => ({ value: x, label: x })));

View File

@@ -1,5 +1,5 @@
<script>
import { currentStream } from '$lib/stores.js';
import { currentStream } from '$lib/stores.svelte.js';
currentStream.set({});
</script>

View File

@@ -5,7 +5,7 @@
import MetadataEditor from './MetadataEditor.svelte';
import Player from './Player.svelte';
import { dev } from '$app/environment';
import { currentStream, updateCurrentStream } from '$lib/stores.js';
import { currentStream, updateCurrentStream } from '$lib/stores.svelte.js';
let { data } = $props();

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { page } from '$app/stores';
import { tagList } from '$lib/stores.js';
import { tagList } from '$lib/stores.svelte.js';
let { original = $bindable() } = $props();

View File

@@ -24,7 +24,7 @@
currentStream,
getSongAtTime,
updateCurrentSong
} from '$lib/stores.js';
} from '$lib/stores.svelte.js';
interface Props {
src: any;

View File

@@ -1,5 +1,5 @@
<script>
import { currentStream, currentSongIndex } from '$lib/stores.js';
import { currentStream, currentSongIndex } from '$lib/stores.svelte.js';
import { shorthandCode, formatTrackTime, formatDate } from '$lib/utils.js';
import { jumpToTrack } from './Player.svelte';
import { Carta } from 'carta-md';