diff --git a/src/components/player/atoms/Episodes.tsx b/src/components/player/atoms/Episodes.tsx
index eee474a1..f79e2081 100644
--- a/src/components/player/atoms/Episodes.tsx
+++ b/src/components/player/atoms/Episodes.tsx
@@ -1,5 +1,5 @@
import classNames from "classnames";
-import { ReactNode, useCallback, useEffect, useState } from "react";
+import { ReactNode, useCallback, useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { useAsync } from "react-use";
@@ -196,9 +196,14 @@ function EpisodesOverlay({
}) {
const router = useOverlayRouter(id);
const meta = usePlayerStore((s) => s.meta);
- const [selectedSeason, setSelectedSeason] = useState(
- meta?.season?.tmdbId ?? ""
- );
+ const [selectedSeason, setSelectedSeason] = useState("");
+
+ const lastActiveState = useRef(false);
+ useEffect(() => {
+ if (lastActiveState.current === router.isRouterActive) return;
+ lastActiveState.current = router.isRouterActive;
+ setSelectedSeason(meta?.season?.tmdbId ?? "");
+ }, [meta, selectedSeason, setSelectedSeason, router.isRouterActive]);
const setSeason = useCallback(
(seasonId: string) => {
@@ -215,12 +220,14 @@ function EpisodesOverlay({
- router.navigate("/")}
- onChange={onChange}
- />
+ {selectedSeason.length > 0 ? (
+ router.navigate("/")}
+ onChange={onChange}
+ />
+ ) : null}