Improve Watchlist page handling items being watchlisted/unwatchlisted within a given session

This commit is contained in:
HighImKevin
2026-10-17 07:03:45 -04:00
parent a9b055e0e7
commit 0ac2c6415e
3 changed files with 103 additions and 18 deletions
+12
View File
@@ -344,9 +344,17 @@
cachedServerVersion: null
}
/**
* Fields used by progressive Watchlist sections. Must match getWatchlistQuery /
* invalidateWatchlistQueries so cache clear hits the same URL as fetch.
*/
const WATCHLIST_PROGRESSIVE_FIELDS =
'PrimaryImageAspectRatio,DateCreated,ProductionYear,PremiereDate,ProviderIds,UserData';
/**
* Build a single top-level Likes query def (shared by getWatchlistItems / getWatchlistQuery).
* Callers pass IncludeItemTypes (and other options) to narrow results.
* Default Fields match progressive sections so invalidate clears the fetched URL.
* @param {Object} options
* @returns {{ queryOptions: Object }}
*/
@@ -356,6 +364,7 @@
Recursive: true,
ImageTypeLimit: 1,
EnableImageTypes: 'Primary,Backdrop,Thumb',
Fields: WATCHLIST_PROGRESSIVE_FIELDS,
...options,
Filters: 'Likes'
}
@@ -1501,6 +1510,9 @@
return genreSyncScheduledPromise;
}
// Shared with watchlist progressive sections / invalidate (same Fields → same cache URL)
apiHelper.WATCHLIST_PROGRESSIVE_FIELDS = WATCHLIST_PROGRESSIVE_FIELDS;
// Expose apiHelper to global window object
window.apiHelper = apiHelper;