Only refresh the Collections cache when loading an item page which may be included in a Collection

This commit is contained in:
HighImKevin
2025-11-26 05:49:21 -05:00
parent 24a110aa0b
commit 16c939aa44
+10 -6
View File
@@ -69,7 +69,7 @@
// Wait for all fetches to complete
const collectionResults = await Promise.all(collectionPromises);
const endTime = performance.now();
const duration = endTime - startTime;
LOG(`Collections cache populated in ${duration.toFixed(2)}ms`);
@@ -225,8 +225,6 @@
return;
}
await populateCollectionsCache();
// Only handle details pages
const activePage = document.querySelector('.libraryPage:not(.hide)');
if (!activePage) return;
@@ -234,6 +232,15 @@
// Await the item promise to get the actual item data
const item = await itemPromise;
const supportedTypes = ['Movie', 'Series', 'Season', 'Episode', 'MusicArtist', 'MusicAlbum', 'Audio', 'Book', 'AudioBook', 'MusicVideo' ];
if (!supportedTypes.includes(item.Type)) {
LOG(`Item type ${item.Type} not supported for collections, skipping...`);
return;
}
await populateCollectionsCache();
// Small delay to ensure details DOM is ready
setTimeout(async () => {
if (item && item.Id) {
@@ -265,9 +272,6 @@
return;
}
// Forcefully populate the collections cache
populateCollectionsCache(true);
// Initialize collections hook
initializeCollectionsHook();
}