fix: season selector not working

This commit is contained in:
James Hawkins 2021-08-06 20:03:18 +01:00
parent 7d7bf312b7
commit 1d4988c4dd
2 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ export function EpisodeSelector({ setSelectedSeason, selectedSeason, setEpisode,
return ( return (
<div className="episodeSelector"> <div className="episodeSelector">
<TypeSelector setType={setSelectedSeason} choices={seasons.map(v=>({ value: v.toString(), label: `Season ${v}`}))} selected={selectedSeason}/><br></br> <TypeSelector setType={setSelectedSeason} selected={selectedSeason} choices={seasons.map(v=>({ value: v.toString(), label: `Season ${v}`}))} /><br></br>
<NumberSelector setType={(e) => setEpisode({episode: e, season: selectedSeason})} choices={choices} selected={(selectedSeason.toString() === currentSeason) ? currentEpisode : null} /> <NumberSelector setType={(e) => setEpisode({episode: e, season: selectedSeason})} choices={choices} selected={(selectedSeason.toString() === currentSeason) ? currentEpisode : null} />
</div> </div>
) )

View File

@ -35,7 +35,8 @@ export function MovieView(props) {
React.useEffect(() => { React.useEffect(() => {
if (streamData.type === "show" && showRouteMatch) setSelectedSeason(showRouteMatch.params.season.toString()); if (streamData.type === "show" && showRouteMatch) setSelectedSeason(showRouteMatch.params.season.toString());
}, [showRouteMatch, streamData]); // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
React.useEffect(() => { React.useEffect(() => {
let cancel = false; let cancel = false;
@ -83,7 +84,6 @@ export function MovieView(props) {
React.useEffect(() => { React.useEffect(() => {
if (streamData.type === "show") { if (streamData.type === "show") {
setSeasonList(streamData.seasons); setSeasonList(streamData.seasons);
setSelectedSeason(selectedSeason)
setEpisodeList(streamData.episodes[selectedSeason]); setEpisodeList(streamData.episodes[selectedSeason]);
} }
}, [streamData, selectedSeason]) }, [streamData, selectedSeason])