fix(playlists): update player state after pressing play

This commit is contained in:
2024-12-02 22:27:51 +01:00
parent 0266cf8e80
commit 19f8fde191
2 changed files with 12 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
import type { SubmitFunction } from '../../../routes/playlists/[id]/$types';
import { getCoverUrl } from '$lib/covers';
import { getLibraryState } from '$lib/library.svelte';
import { getPlayerState } from '$lib/player.svelte';
interface Props {
id: number;
@@ -21,6 +22,7 @@
);
const library = getLibraryState();
const player = getPlayerState();
let coverImages = $derived.by(() => {
if (tracks.length === 0) {
@@ -53,11 +55,15 @@
});
const playPlaylist: SubmitFunction = async () => {
return async ({ update }) => {
return async ({ update, result }) => {
await update({
invalidateAll: false,
reset: false
});
if (result.type === 'success' && result.data) {
player.applyStatus(result.data);
}
};
};