style: auto-fix linting issues

This commit is contained in:
JulienMaille 2026-01-16 22:18:36 +00:00 committed by github-actions[bot]
parent 36d209de88
commit 8759cae36b

View file

@ -337,13 +337,14 @@ export class MusicDatabase {
}
console.log(`${storeName}: Adding item with ID ${item.id || item.uuid || item.timestamp}`);
// Critical: Ensure key exists for IndexedDB store.put()
const keyPath = store.keyPath;
if (keyPath && !item[keyPath]) {
console.warn(`Item missing keyPath "${keyPath}" in ${storeName}, generating fallback.`);
if (keyPath === 'uuid') item.uuid = crypto.randomUUID();
else if (keyPath === 'id') item.id = item.trackId || item.albumId || item.artistId || Date.now() + Math.random();
else if (keyPath === 'id')
item.id = item.trackId || item.albumId || item.artistId || Date.now() + Math.random();
else if (keyPath === 'timestamp') item.timestamp = Date.now() + Math.random();
}