fix(web-player): follow the API types where they are nullable

The checked-in schema was stale and typed artist, description and externalId
as always present, so the code trusted values the API returns as null. The
regenerated schema tells the truth; the API-shaped types now admit null and it
is normalised on the way into the player, where the state stays non-null.
This commit is contained in:
2026-07-20 20:20:34 +02:00
parent 22ed923a04
commit 27f3c02915
12 changed files with 505 additions and 24 deletions
@@ -41,7 +41,7 @@ export const load: PageServerLoad = async ({ params, locals, url, fetch }) => {
const alreadyLinked = new Set(
tracks.filter((t) => t.source === 'YouTube' && t.externalId).map((t) => t.externalId)
);
const seeds = [...new Set(tracks.map((t) => t.artist).filter((a) => !!a))];
const seeds = [...new Set(tracks.map((t) => t.artist).filter((a): a is string => !!a))];
const seed = seeds.length > 0 ? shuffle(seeds)[0] : undefined;
const youtube = fetchYoutubeFiller(
@@ -66,7 +66,7 @@
<PlaylistForm
action="?/rename"
initialName={playlist.name}
initialDescription={playlist.description}
initialDescription={playlist.description ?? ''}
coverFallbackUrl="/api/playlists/{playlist.id}/cover?size=medium&v={encodeURIComponent(
playlist.updatedAt
)}"
@@ -11,7 +11,7 @@
interface Props {
id: string;
name: string;
description?: string;
description?: string | null;
trackIds: (string | number)[];
updatedAt: string;
playing: boolean;
@@ -71,7 +71,7 @@
: {
id: queueIdForTrack(item.track),
title: item.track.title,
artist: item.track.artist,
artist: item.track.artist ?? undefined,
source: 'local',
coverUrl: `/api/tracks/${item.track.id}/cover?size=small`
};