From 16c939aa446fe09fc3f76d1dd8281b4ef02add1c Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Wed, 26 Nov 2025 05:49:21 -0500 Subject: [PATCH] Only refresh the Collections cache when loading an item page which may be included in a Collection --- scripts/itemDetailsCollections.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/itemDetailsCollections.js b/scripts/itemDetailsCollections.js index e7ef983..a0912b4 100644 --- a/scripts/itemDetailsCollections.js +++ b/scripts/itemDetailsCollections.js @@ -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(); }