From aa234487c1f14ea8c32c4c2613f106e2c9b5b851 Mon Sep 17 00:00:00 2001 From: Julien Maille Date: Tue, 30 Dec 2025 12:09:56 +0100 Subject: [PATCH] imp: prevent storing undefined properties --- js/db.js | 8 ++++---- js/firebase/sync.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/db.js b/js/db.js index eeeab90..eff82fa 100644 --- a/js/db.js +++ b/js/db.js @@ -169,7 +169,7 @@ export class MusicDatabase { releaseDate: item.album.releaseDate || null } : null, // Fallback date - streamStartDate: item.streamStartDate, + streamStartDate: item.streamStartDate || null, // Keep version if exists version: item.version || null }; @@ -180,12 +180,12 @@ export class MusicDatabase { ...base, title: item.title, cover: item.cover, - releaseDate: item.releaseDate, + releaseDate: item.releaseDate || null, explicit: item.explicit, // 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), // Keep type and track count for UI labels - type: item.type, + type: item.type || null, numberOfTracks: item.numberOfTracks }; } @@ -194,7 +194,7 @@ export class MusicDatabase { return { ...base, name: item.name, - picture: item.picture || item.image // Handle both just in case + picture: item.picture || item.image || null // Handle both just in case }; } diff --git a/js/firebase/sync.js b/js/firebase/sync.js index 2ea1513..5b46d35 100644 --- a/js/firebase/sync.js +++ b/js/firebase/sync.js @@ -105,7 +105,7 @@ export class SyncManager { }); } } - + return Array.from(map.values()); };