diff --git a/gui/react/src/components/AddToQueue/DownloadSelector/Listing/EpisodeListing.tsx b/gui/react/src/components/AddToQueue/DownloadSelector/Listing/EpisodeListing.tsx index 0d34d96..c7cd799 100644 --- a/gui/react/src/components/AddToQueue/DownloadSelector/Listing/EpisodeListing.tsx +++ b/gui/react/src/components/AddToQueue/DownloadSelector/Listing/EpisodeListing.tsx @@ -42,6 +42,10 @@ const EpisodeListing: React.FC = () => { }); }; + const getEpisodesForSeason = (season: string|'all') => { + return store.episodeListing.filter((a) => season === 'all' ? true : a.season === season) + } + return 0} onClose={close} scroll='paper' maxWidth='xl' sx={{ p: 2 }}> @@ -68,19 +72,19 @@ const EpisodeListing: React.FC = () => { if (selected.length > 0) { setSelected([]); } else { - setSelected(store.episodeListing.map(a => a.e)); + setSelected(getEpisodesForSeason(season).map(a => a.e)); } }} /> - {store.episodeListing.filter((a) => season === 'all' ? true : a.season === season).map((item, index, { length }) => { + {getEpisodesForSeason(season).map((item, index, { length }) => { const e = isNaN(parseInt(item.e)) ? item.e : parseInt(item.e); const idStr = `S${item.season}E${e}`; const isSelected = selected.includes(e.toString()); const imageRef = React.createRef(); const summaryRef = React.createRef(); return - { let arr: string[] = []; if (isSelected) {