diff --git a/components/series/SeasonEpisodesCarousel.tsx b/components/series/SeasonEpisodesCarousel.tsx index 19d79704..38047722 100644 --- a/components/series/SeasonEpisodesCarousel.tsx +++ b/components/series/SeasonEpisodesCarousel.tsx @@ -57,6 +57,7 @@ export const SeasonEpisodesCarousel: React.FC = ({ userId: user.Id, seasonId: seasonId || undefined, seriesId: item.SeriesId, + enableUserData: true, fields: [ "ItemCounts", "PrimaryImageAspectRatio", @@ -70,48 +71,6 @@ export const SeasonEpisodesCarousel: React.FC = ({ enabled: !!api && !!user?.Id && !!seasonId, }); - /** - * Prefetch previous and next episode - */ - const queryClient = useQueryClient(); - useEffect(() => { - if (!item?.Id || !item.IndexNumber || !episodes || episodes.length === 0) { - return; - } - - const previousId = episodes?.find( - (ep) => ep.IndexNumber === item.IndexNumber! - 1, - )?.Id; - if (previousId) { - queryClient.prefetchQuery({ - queryKey: ["item", previousId], - queryFn: async () => - await getUserItemData({ - api, - userId: user?.Id, - itemId: previousId, - }), - staleTime: 60 * 1000 * 5, - }); - } - - const nextId = episodes?.find( - (ep) => ep.IndexNumber === item.IndexNumber! + 1, - )?.Id; - if (nextId) { - queryClient.prefetchQuery({ - queryKey: ["item", nextId], - queryFn: async () => - await getUserItemData({ - api, - userId: user?.Id, - itemId: nextId, - }), - staleTime: 60 * 1000 * 5, - }); - } - }, [episodes, api, user?.Id, item]); - useEffect(() => { if (item?.Type === "Episode" && item.Id) { const index = episodes?.findIndex((ep) => ep.Id === item.Id); diff --git a/components/series/SeasonPicker.tsx b/components/series/SeasonPicker.tsx index f358ff72..3d7ba5fa 100644 --- a/components/series/SeasonPicker.tsx +++ b/components/series/SeasonPicker.tsx @@ -87,7 +87,7 @@ export const SeasonPicker: React.FC = ({ item }) => { seasonId: selectedSeasonId, enableUserData: true, // Note: Including trick play is necessary to enable trick play downloads - fields: ["MediaSources", "MediaStreams", "Overview", "Trickplay"], + fields: ["Overview", "Trickplay"], }); if (res.data.TotalRecordCount === 0) @@ -102,23 +102,6 @@ export const SeasonPicker: React.FC = ({ item }) => { }); const queryClient = useQueryClient(); - useEffect(() => { - for (const e of episodes || []) { - queryClient.prefetchQuery({ - queryKey: ["item", e.Id], - queryFn: async () => { - if (!e.Id) return; - const res = await getUserItemData({ - api, - userId: user?.Id, - itemId: e.Id, - }); - return res; - }, - staleTime: 60 * 5 * 1000, - }); - } - }, [episodes]); // Used for height calculation const [nrOfEpisodes, setNrOfEpisodes] = useState(0);