pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge remote-tracking branch 'movie-web/dev'

+14 -10
+14 -10
src/components/player/atoms/NextEpisodeButton.tsx
··· 46 46 ); 47 47 } 48 48 49 - function useSeasons(mediaId: string, isLastEpisode: boolean = false) { 49 + function useSeasons( 50 + mediaId: string | undefined, 51 + isLastEpisode: boolean = false, 52 + ) { 50 53 const state = useAsync(async () => { 51 54 if (isLastEpisode) { 52 - const data = await getMetaFromId(MWMediaType.SERIES, mediaId ?? ""); 55 + if (!mediaId) return null; 56 + const data = await getMetaFromId(MWMediaType.SERIES, mediaId); 53 57 if (data?.meta.type !== MWMediaType.SERIES) return null; 54 58 return data.meta.seasons; 55 59 } ··· 60 64 61 65 function useNextSeasonEpisode( 62 66 nextSeason: MWSeasonMeta | undefined, 63 - mediaId: string, 67 + mediaId: string | undefined, 64 68 ) { 65 69 const state = useAsync(async () => { 66 70 if (nextSeason) { 71 + if (!mediaId) return null; 67 72 const data = await getMetaFromId( 68 73 MWMediaType.SERIES, 69 - mediaId ?? "", 74 + mediaId, 70 75 nextSeason?.id, 71 76 ); 72 77 if (data?.meta.type !== MWMediaType.SERIES) return null; ··· 105 110 const enableAutoplay = usePreferencesStore((s) => s.enableAutoplay); 106 111 107 112 const isLastEpisode = 108 - meta?.episode?.number === meta?.episodes?.at(-1)?.number; 113 + !meta?.episode?.number || !meta?.episodes?.at(-1)?.number 114 + ? false 115 + : meta.episode.number === meta.episodes.at(-1)!.number; 109 116 110 - const seasons = useSeasons(meta?.tmdbId ?? "", isLastEpisode); 117 + const seasons = useSeasons(meta?.tmdbId, isLastEpisode); 111 118 112 119 const nextSeason = seasons.value?.find( 113 120 (season) => season.number === (meta?.season?.number ?? 0) + 1, 114 121 ); 115 122 116 - const nextSeasonEpisode = useNextSeasonEpisode( 117 - nextSeason, 118 - meta?.tmdbId ?? "", 119 - ); 123 + const nextSeasonEpisode = useNextSeasonEpisode(nextSeason, meta?.tmdbId); 120 124 121 125 let show = false; 122 126 const hasAutoplayed = useRef(false);