style: auto-fix linting issues
This commit is contained in:
parent
36d209de88
commit
8759cae36b
1 changed files with 3 additions and 2 deletions
5
js/db.js
5
js/db.js
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue