imp: prevent storing undefined properties

This commit is contained in:
Julien Maille 2025-12-30 12:09:56 +01:00
parent 82b4afb149
commit aa234487c1
2 changed files with 5 additions and 5 deletions

View file

@ -169,7 +169,7 @@ export class MusicDatabase {
releaseDate: item.album.releaseDate || null releaseDate: item.album.releaseDate || null
} : null, } : null,
// Fallback date // Fallback date
streamStartDate: item.streamStartDate, streamStartDate: item.streamStartDate || null,
// Keep version if exists // Keep version if exists
version: item.version || null version: item.version || null
}; };
@ -180,12 +180,12 @@ export class MusicDatabase {
...base, ...base,
title: item.title, title: item.title,
cover: item.cover, cover: item.cover,
releaseDate: item.releaseDate, releaseDate: item.releaseDate || null,
explicit: item.explicit, explicit: item.explicit,
// UI uses singular 'artist' // UI uses singular 'artist'
artist: item.artist ? { name: item.artist.name, id: item.artist.id } : (item.artists?.[0] ? { name: item.artists[0].name, id: item.artists[0].id } : null), artist: item.artist ? { name: item.artist.name, id: item.artist.id } : (item.artists?.[0] ? { name: item.artists[0].name, id: item.artists[0].id } : null),
// Keep type and track count for UI labels // Keep type and track count for UI labels
type: item.type, type: item.type || null,
numberOfTracks: item.numberOfTracks numberOfTracks: item.numberOfTracks
}; };
} }
@ -194,7 +194,7 @@ export class MusicDatabase {
return { return {
...base, ...base,
name: item.name, name: item.name,
picture: item.picture || item.image // Handle both just in case picture: item.picture || item.image || null // Handle both just in case
}; };
} }